Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 39 Next »

Email This Issue Mail Handlers

Mail Handlers in Jira provide a basic functionality to create issue or comments from emails. In most cases the out-of-the-box native functionality is too limited.

Email This Issue Mail Handlers add a lot more on this to implement sophisticated email processing:

  • Initialize issue fields from email content
  • Execute workflow transitions
  • Filter emails depending on content (e.g. spam)
  • Save Senders and Recipients to custom fields
  • Content splitting on multiple regular expressions
  • Send auto-reply emails

Configure Mail Handlers

Email This Issue Mail Handlers are composed of two components. Two basic steps to configure a mail handler:

  1. Add a Mail Handler in Jira's Incoming Mail Page to hook into the Jira API that passes the downloaded email messages to the handlers
  2. Add a Mail Handler Context in Email This Issue to fully configure the rich functionality comes with the addon

Simplified Configuration

If a Mail Handler Context is not added, one is created upon the first email being processed with default settings. 

The Incoming Mail Handler example:

Mail Handler Contexts

Mail Handler Contexts just like any other "Contexts" in Email This Issue are used to add configure in a flexible way depending on Project and Issue Type. You can define "broad" contexts that are applied to all projects and / or issue types.

Mail Handler Contexts are used in conjunction with the JETI Mail Handlers. If you set up the handler to create issues in project "MyProject" of type "Bug", there must be a Mail Handler Context that can be resolved to match this combination, e.g. a Mail Handler Context configured with project "MyProject" or type "Bug" or both.

Mail Handler Context Attributes

ProjectProject to which the context applies. If left empty, context applies to all projects(error)
Issue TypeIssue Type to which the context applies. If left empty, context applies to all issue types(error)
Email Processing Strategy

Determines how Email This Issue Mail Handler processes the incoming emails.

There are various strategies available out-of-the-box:

  • Create Or Comment Issues: either create new issue or comment it. It supports Split Regex (see below)
  • Create Or Comment Or Link Issues: either create new issue or comment it if the issue matches the given JQL criteria, otherwise Create a new issue and link it. It supports Split Regex (see below)..
  • Always Add Comments: find a related issue for each email and if found, comment it. It supports Split Regex (see below)..
  • Always Create Issues: create new issues for all incoming emails.
  • Service Desk Create or Comment
  • Create Issues or Email Log: No comments will be added.

All strategies also do the following (if configured to do so):

  • Execute transition on the issue: if ticked, the mail handler executes a workflow transition on the issue (see below for more details)
  • Initialize Issue Fields: if ticked, the mail handler looks up a Field Context and applies its field rules to initialize issue fields.
  • Override Issue Lookup: if ticked, the mail handler looks up a Field Context  and applies its issue lookup field rules to find the issue that can be associated with the incoming email.
Mail Handler EventAn issue event that is fired for each incoming emails that the mail handler processes.(error)
Acknowledge New Issuesif an email template is selected here, it will be used to generate auto-acknowledge emails when a new issue is created from email.(error)
Acknowledge New Commentsif an email template is selected here, it will be used to generate auto-acknowledge emails when a new comment is added to an issue from email.(error)
User Recipients

This attribute deteremines how the mail handler should treat users recognized for recipient email addresses.

Options are:

  • save as watchers in the issue
  • save them in the selected user picker field
  • treat them as email addresses and save the email addresses in the recipient fields (see below)
Sender FieldCustom field selected here will be used to store email addresses of the email senders(error)
Recipient FieldCustom field selected here will be used to store email addresses of the email senders(error)
Copy Recipient FieldCustom field selected here will be used to store email addresses of the email senders(error)
Email Address ExclusionEmail addresses (one per line) entered here are not saved in the sender or recipient fields. Supports regular expressions, to make sure your email address exclusion will not run into problems include (?i) at the beginning of the email address.(error)
Split RegexRegular expressions (one per line) entered here are used to split email body by a delimited. See more details below.(error)
Jira Mail Strategy

Specifies how to treat emails sent from the current or another Jira instance. Options are availabe to accept or ignore these emails.

Please be careful to avoid email loops when sending emails between Jira instances.

Ignore Issue ID in Email Headers

By default, Email This Issue checks for the "In-Reply-To" and "References" email headers for Jira IDs if no issue keys appear in the email subject. If such an issue ID is found, it comments the issue.

Enabling this option you can override the default behaviour and make JETI ignore these emails headers. It can be userful to prevent confusions when an email sent from Jira is replied or forwarded back to Jira. In such cases, seemingly unrelated issue may be commented. If this option is turned on, JETI will only use the email subject and its own Issue Lookup Field Rules but will ignore the invisible email headers.

External Email SendersSpecify how to treat emails sent from email addresses not registered as users in Jira. Options are to accept the mails for processing or to ignore (leave in mailbox) these emails. If you want to prevent the situation that practically anyone could pollute your Jira instance by sending emails, simply set this option to Ignore.

Split Regex Support

Email This Issue Mail Handler supports regular expressions to split email body into new content and original messages and import only the new content. See this page and the Jira documentation for more details on this topic.

Multiple regular expressions can be entered in the Mail Handler Context.

Split regex support works the same way as of Jira's but JETI supports multiple expressions not only one expression.

Regular expressions must follow Perl5 syntax.

An example regex that many users successfully use is:

/\s*From:|___.|On .wrote:|----Orig.|On .(JIRA)./

Split regex may match HTML tags in HTML emails.

Email Processing Strategy

As written above If you configure Email This Issue Mail Handler in the Incoming Mail section of Jira's Administration page, you must add a corresponding Mail Handler Context to fine tune your mail handler.

A fully configured mail handler example is this:

HTML Content Preserved with Inline Images

Email This Issue Mail Handler retains the HTML layout and content of the incoming emails including inline images. Send an HTML formatted email to Jira and see the original content and layout in the issue.

This feature works if the Issue Description and Comment fields are configured with the JEditor Renderer type. This requires JEditor to be installed and licensed properly in Jira.

Execute transition on issues

Email This Issue Mail Handler executes a transition on the issue that is associated with the email that is being processed. 

The transition to execute is identified by a transition property called Add this property to the transitions in the statuses of the workflows, set its value to "true". JETI executes the first transition that has this property in the status the issue is in. Also you must enable "Execute transiton" attribute in the Mail Handler:

Example Use Cases when to Use This Feature

Use Case #1:

JETI mail handler is processing an email that is associated with an Issue that is Closed. JETI besides adding a comment to the issue, may execute a "Reopen" transition to reopen the issue for further investigation.

Use Case #2:

JETI is processing an email and creates a new issue in status Open, after the issue is created it executes a transition to move the Issue to new status called "Raised via email".


Email This Issue Mail Handler skips emails sent from blacklisted domains or email addresses. Item in the blacklist are regular expressions. If the sender's email address matches any of the regular expressions, the email is not processed. 

If you configure the Mail Handler in Jira Administration / Incoming Mails with forwarding email option, then JETI will forward the skipped emails to this address.

Blacklist is maintained in the Configuration tab of the JETI Admin screen.

Fallback to Default Reporter

Email This Issue Mail Handler falls back to the Default Reporter when Jira users who send email do not have permission to create or comment in the project. Jira would simply skip these emails, while JETI imports them with the default reporter.

Fire Event

Email This Issue Mail Handler can fire an event when it processes an email.

Example Usage:

  • Define a custom event in Jira Administration, e.g. "Email Processed" (this is optional, you can use a system event too)
  • Edit your Mail Handler Context and select "Email Processed" in the Mail Handler Event field
  • Configure your JETI Event Notifications for "Email Processed" with recipients or have a custom Event Listener to react on emails.

Set Issue Fields from Email

Email This Issue Mail Handler allows you to fill issue fields (system fields and custom fields), execute workflow transitions from email content of the email. 

  • No labels