Why does an email processing fail but when its converted to a Test Case via Audit History, it works?

Scenario

An incoming message fails to be processed for some reason, but when that failed message is converted to a Test Case, it works.

Explanation

Why it breaks

JIRA and JEMH both use Javamail, a standards based reference implementation for Java email handling.  Incoming messages that do not conform to standards run the risk of failing Javamail validation checks, and being rejected (actually, exceptions are thrown by default, literally making the message inaccessible to JEMH).  Of course, there could also be a bug, but current releases are battle tested around the world!

Why Test Cases work

As soon as an email is handed to JEMH from JIRA, JEMH creates an Audit Event, as part of this, the complete email is serialized (saved) to disk in JIRA_HOME/data/jemh/auditmail this save process is Javamail, interpreting the mail content and rebuilding a mail file in text form.  This process has been found to correct some of the problems that cause Javamail to not process messages initially.  When Javamail processes these messages in Test Case form, they now pass validation and everything works!

Older releases of JEMH have a three-step recovery process for such messages:

  • locate audit history event

  • convert to a Test Case via option

  • run Test Case

Re-Processing (Post failure batch processing)

Re-processing allows coded solutions to en-masse emails that failed owing to a configuration issue.  Current 1.4.x releases have Re-Processing features, which add a new option to Audit History event options, to automatically reprocess a given mail. See Use Audit History Reprocessing.  This method is a way to apply specific rules to a range of emails. 

Use Pre-Processed Message (Just In Time Fix)

Pre-Processed messages attempt to fix some syntax issues and avoid a failure, its not possible to know 'where' a message processing will break, so this needs to be done for every message, rather than in some kind of 'detection' code.  Enabling Pre-Processed messages is attractive in some instances to reduce 'bad' message counts, but there is an overhead in loading the message off disk and rebuilding 'the email' before use, its not onerous, but its there.

To enable Pre-Processed messages, set the profile field Email > Pre-Processing > Use Reprocessed Message ON