Versions Compared

Key

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

Table of Contents

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
Note
titleSimplified 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:

Image Removed

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.

Image Removed

Mail Handler Context Attributes

...

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.

...

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)

...

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

Note

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

...

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.

...

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:

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

Split regex may match HTML tags in HTML emails.

Tip
titleRead more

How to remove old content from reply 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:

Image Removed

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.

Note

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 jeti.on.email.transition. 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:

Image Removed

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".

Blacklisting

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.

Image Removed

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.

Image Removed

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

...

Redirect
filename
locationhttps://docs.meta-inf.hu/email-this-issue-for-jira-server-data-center/documentation/incoming-emails/mail-handlers

Thank you for visiting our old product documentation site. Note that we no longer store or update our documentation here.

Please navigate to our new documentation site and update your bookmarks accordingly. If you're looking for the former content of this page, click here.