Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Directive key

Example using At Prefix Field Processor (in email body)

Example using Subject Field Processor (in subject)

Name or ID of field e.g. My Custom Field

@My Custom Field = value for my field

#customfield_10105=value for my field

Using Directives with different Custom Field Types

Field Type

Description

Example using At Prefix Field Processor (in email body)

Checkbox

The value that is being set must already exist as an option within the Custom Field Configuration. If the value is not found it will result in the Custom Field not being updated.

@Custom Field = value

Note

Note that from JEMH 2.5.1 date values supplied by email directives are locale sensitive. This means that for example, a Jira user who's profile is set to Spanish should send date values such as 3/ene/19 instead of 3/jan/19.

Prior to 2.5.1, date values should be sent using the system default locale.

...

Column

Special Processing

Event Type

As inbound mail can contain a variety of fields, content could trigger any of the stock event templates (e.g. issuecommented.vm).  By default the issueupdated.vm template is used.  By enabling the following option, the event type will be automatically selected as appropriate.  The rule of thumb is that if a single type of information is provided (e.g. a comment, a worklog), that event would be used, combined input will result in a standard IssueUpdated event being used.

  1. dynamicEventTypeSelection=true

Sender Email Address

The sender email address can be redirected into a nominated Custom Field:

  1. assignJiraUsersOriginalEmailAddressToCustomField=Some Field

CC:

Info

Users can be created through CC:

If the create user Options allow, each CC: will be auto-created as well, if they don't resolve to a known Jira user.

There are several Options for CC: handling, if enabled, can be:

  1. ccHandling=toWatcher, which will trigger the identification of Jira users through given email addresses and add those with valid Jira accounts as watchers

  2. ccHandling=toCustomField, which will trigger the identification of Jira users through the given email addresses and also add those users to a Custom Field, which is nominated through ccHandlingTargetCustomFieldName (which must be a CF of type MultiUserCF). Additionally, its possible to route non-Jira associated emails to a different simple text CF, with ccHandlingNonJiraUserTargetCustomFieldName.

These options are not mutually exclusive, e.g. ccHandling=toWatcher,toCustomField

Attachments

If any attachments are present in either initial creation or comments, they will be added to the issue.

IssueType

The issueType can be determined in several ways:

  1. If the defaultIssueType Option is set, it will be used if no other issueType Directive is found

  2. If the issueType Directive is set in an email (can be ID or Name) , e.g.:

    • (in the body) @issueType = bug

    • (in the body) issueType: task

    • (in the subject) #issueType=risk

Field Processors

Note

JEMH has several 'Field Processors' who's job it is to process inbound email and generate from it a map of key/value pairs.
The Configuration option emailFieldProcessorPackageList is mandatory and specifies a package within which are Field Processors.  If this key is missing, the package is wrong, or for some reason the classes cannot be found, then JEMH will not do much.

There are many known keys for emails which are covered on the main add-on page.  JEMH has been written with extension and customization in mind.  The existing Configuration includes the following Options:

  • emailFieldProcessorPackageList - specifies a list of packages to search for FieldProcessor implementations, either extensions of the superclass AbstractFieldProcessorHelper or direct implementations of IMessageFieldProcessor.

  • emailFieldProcessorPriorityLowerLimit - each Field Processor has a 'priority' value, this is the lower inclusion limit (an integer)

  • emailFieldProcessorPriorityUpperLimit - as above, this is the upper inclusion limit (an integer)

Initial issue creation notifications for all

If the Option notifyUsersOnIssueCreation is set, (values are none,nonjira,jira,all), it is possible to trigger notifications of issue creation, separate to the Jira notification scheme.  The purpose of this is to enable users who send email into Jira (when auto-creation is not on, or they don't qualify) to get some kind of notification that the issue got created.  This currently only applies to the original email sender.

Customisation of from: address for JEMH sourced notifications

The following options, if either is specified, will override whatever Jira defaults have been setup on the default mail server:

  • customEmailFromAddress , eg: jemh@myco.net

  • customEmailFromName, eg: JEMH Mail Handler

Stripping Quotes

The Option stripQuotes enables inbound emails to be automatically stripped of indented content indicative of the reply-to-jira-mail scenario.  This stops ever longer duplicate content additions.

Tip

Overriding stripQuotes

Sometimes you actually do want an email to be kept intact, say, forwarding in a Thread that didn't involve Jira.  To override this behaviour, use the stripComments Directive (eg @stripComments=true)

Notify users without eating Jira license seats

A problem with the Jira license model is that sometimes you want to enable customers to send emails to Jira, to create tickets, those users don't need to be able to login to Jira but do need to receive related issue update notifications.  JEMH can do this, if you set it up as follows:

(info) Gutting the example configuration file does more than just remove fields you don’t care about (right now), it removes the related documentation.  My advice is to keep the example, just comment out what you don't need.

Required configuration fields

Note

Incomplete configuration options

The fields specified below are just in relation to this function, do not consider it complete and usable, it wont work, see the example and docs above.

Issue Creation

In order to create issues, that user must have 'Jira User' global privilege, normally this is given to jira-users.  In order to create issues you must provide a userid that has such membership, and privileges in the project (perhaps identified through the defaultProject configuration option:

Code Block
#set a default project (there are other ways, see config file for details)
defaultProject=someproject

#pick a default (fallback) user that will be used if the from: email acct does not correlate to a known Jira user
defaultReporterUsername=someuserid

This now enables issues to be created by anyone, but is not attributed to them directly.

Creating users without taking Jira seats

In order to support the notification of users, the approach is to create users without giving them 'Jira User' global privilege.  Given that you must provide access to users without knowing their ID, you must also nominate a group, which is likely given 'User' privilege in your project (specifically, the Browse Project permission).  The exact nature of the userId is configurable and is extendable, but is not required:

Code Block
#trigger user creation
createUsers=true

#join a specific group with privilege to your project
autoJoinGroup=email-accounts

#dont notify users when they get an account created automatically (as they can't log in anyway)
notifyUsers=false

#get JEMH to send a manual issue created notification to non jira users (see docs for other options)
notifyUsersOnIssueCreation=nonjira

Overall function

When the issue has been created, the issue creator is set to the defaultReporterUsername, the remote email user that has been created, is added as a watcher, and will now receive subsequent notifications.

Gliffy
nameCreating issues and get notified without eating Jira licenses
pageid2850881

Blocklisting and Allowlisting

There are several reasons you may want to block certain emails, for example:

  1. As Jira doesn't allow easy 'disablement' of users, it will happily continue to send emails to their account with status updates, filter output etc.  If that user has left the company and has been disabled, your mailserver may reject Jiras mail, right back to the inbox of JEMH. You don't want that.

  2. Even valid users email accounts can get hijacked and generate bot-spam

JEMH provides pretty comprehensive filtering behaviour to nail the annoying emails that you cant get filtered some other way:

Allowlisting

  • allowlistSenders - identifies regexps for email addresses that are valid and should be processed

Blocklisting

  • blocklistSenders - identifies regexps for email addresses that should not be processed

  • blocklistRecipients - for example, stop people emailing replies to noreply-dummo@jira.myco.net

  • silentlyDropBlocklistMatches - if you get a blocklist match, drop it? saves one delete click per email!

Greylisting

  • greylistSenders - identifies regexps for email addresses that, after allow/block listing, should be further checked

  • greylistSendersSubjectRegexps - identifies subject regexps (comma separated) allowing specific mail content to be added to be blocked from further processing

  • greylistRelatedUserBodyRegexp - an advanced feature, this will allow a body content to be regexp'd to extract the email address of a user that the email relates.  The scenario here is your mailserver rejecting an email due to the user being disabled, receiving the bounce (from a allowlisted domain, but greylisted sender) that sometimes gives you useful information (ie doesn't warrant being on the blocklistRecipients list).  The value is used to check that the user is disabled, and if so, its a greylist match.

  • silentlyDropGreylistMatches - if you get a greylist match, drop it? saves one delete click per email!

Customizing the Hint/Reject Emails

The Hints generated during processing are rendered through two sets of template files, HTML and plain text.  If an inbound email from: address is found to relate to a Jira user, that users email format preferences are used, plain text otherwise.

Hint template files

The locations of the templates are in the JAR under /templates/email/jemh/html and /templates/email/jemh/text.  To customize, just take copies and add to the WEB-INF/classes/templates tree.

Hint ID's

Some hints have numeric ID's associate with them to allow custom .vm level content provision over the perhaps verbose techno-babble message.  These can be added on request.

Trouble Shooting

Email Errors

Fields on long lines are not found or truncated in Jira

This can happen when custom fields or description fields contain more than trivial information, e.g. > ~80 characters:

  • If you happen to use Outlook, go to _Options/Mail Format/Internet Format/Plain text options.  Increase the wrap length to accommodate your maximum line length, the max is apparently 132 chars.
    (info) The linux 'mail' command line utility has been tested and does not suffer from this problem.

Problems with WYSIWYG Rendering of description field.

See JEMH-55. Workaround for now is use wiki-renderer.

Problems with email subject truncation using # character?

This is because the SubjectBasedFieldProcessor is trying to process those values.  To stop that you can either change the emailFieldProcessorPriorityLowerLimit and emailFieldProcessorPriorityUpperLimit to select the range (only) of processors to employ according to the table below:

Code Block
# MailFormNg format priority: 1000
# Subject priority: 2000
# AtPrefix format priority: 1100
# XML : 5000
# CSV format priority : 10000
# Nagios priority : 20000

If that isn't good enough (or if you just want to reduce 'noise' of handlers that aren't ever going to be used) it's also possible to open the Jar an remove the appropriate class with no side-effects.
(info) Leave at least the basic handler there, or there will be a lot of rejects

package: com.javahollic.jira.emh.processor

AtPrefixedFieldProcessor

BasicMailProcessor

ConfluenceMailFormNgFieldProcessor

CSVFieldProcessor

NagiosFieldProcessor

SubjectBasedFieldProcessor

XMLFieldProcessor

Related Articles

Filter by label (Content by label)
showLabelsfalse
max5
showSpacefalse
cqllabel in ( "directives" , "field-processors" ) and type = "page"

...