Handling signatures, replies and forwarded messages
Introduction
JEMH Cloud has features that allow email content to be removed before it is used to create (or comment on) Jira issues.
As a simple example, the body of an email may contain a signature from the sender:
This is my email which contains a basic signature!
--
Robert Smith
Smith & Sons Bakery
Fine foods since 1897
When creating an issue, removing this may be desirable - but it depends! If the majority of your users are external, leaving this data available can be convenient for things such as telephone number or address. On the other hand, if most of your users are internal then the nearly identical signatures may be unwanted.
Removing all content after a specific point
Content can be removed from a configured part of an email onwards. In JEMH, these are called Delimiters. Inside a JEMH project mapping, you will find the following settings under the Pre-processing section:
Setting | Value | Description |
---|---|---|
Create Body Delimiter Texts Comment Body Delimiter Texts | Custom regular expressions or text | Multiple user editable regular expressions or text strings can be entered to to strip signatures and other 'trailing' content that is not required. Regular expressions may not use All expressions are prefixed with a newline ( If you want to match the literal characters |
Create Body Delimiter Regexes Comment Body Delimiter Regexes | Built-in regular expressions or text | Patterns that are found to frequently occur in real life use. They are used to strip signatures and other 'trailing' content that is not required. |
Creating a Test Case
Typically, you may wish to remove content such as email signatures during issue creation - lets use this as an example.
First, you will need to locate an example Test Case in order to verify configuration. JEMH stores recently received content in the database (encrypted!) which makes doing what comes next possible, use Auditing > Inbound Message to locate an example message, select the Generate Test Case action:
Approve:
Go to the Test Case
This Test Case will be used to validate the truncation:
The intent here is to strip the content after the --
which is the standard way to identify a signature block BUT is still prone to false matching (when content contains --
on a new line prior to the signature block, which matches first, causing premature truncation . Edit the Test Case if needed, the content stripping here will not run the test case, just extract content.
Go the pre-processing section of the profile
Locate the profile required, hit the configure icon:
Then click Project Mappings to see the Default Mapping from which all others 'inherit', here we'll configure that so all Mappings get the same behaviour:
Now select Pre-Processing, then edit the section:
Reviewing the Pre-Processing Section
As emails can contain both text and HTML, preferring HTML over text would be needed for example to ensure the Wiki Markup conversion applies:
Preview output
Further down the screen there is an Email Body Regex Tester, click it to expand:
In it, the Test Case created earlier can be selected, the mode chose (default to create), the email test case is shown (click the + to go full screen edit), on expand, it will automatically run, showing what the 'body' will be after applying all the expressions that are shown. Edits made to these expressions can be evaluated without saving, by just hitting the Test button. Here, you'll see the signature text shown in the content block is gone, this was done through a canned expression. When signature text does not start in this way, a user defined expression is needed, for example (NOTE: leading empty line!)
Met vriendelijke groet,
Mr Manager
Applicatie beheer
To match that a user expression like this will be needed to achieve the same result:
When converting HTML Mail, remember that as part of converting HTML to text, some newline injection may occur and is variable (changing your newlines may result in a non-matching expression!)
Removing sections of email content
Rather than removing everything from one point onwards, you may need to instead just remove a particular section. This is done using Clean-ups. Like the previously mentioned Delimiters, Clean-ups are found in the Pre-processing section of project mappings.
Setting | Value | Description |
---|---|---|
Pre Field Processor Body Clean-up Regexes | Custom regular expressions or text | Multiple user editable regular expressions or text strings can be entered to to strip signatures and other 'trailing' content that is not required. Regular expressions may not use |