Versions Compared

Key

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

...

JEMH can detect issue keys in email subjects. If the key points to an existing issue, JEMH can determine that the email is related and comment on the issue instead of create a new one. This behaviour is configurable through two settings found via Profile>Email>Pre-processing:

SettingDescription

Subject IssueKey (comment) Regexps

Regular expression(s) which represent the issue key pattern you want JEMH to look for. By default, JEMH uses the patten \b[A-Z][A-Z_0-9]+-[0-9]+\b . One or more can be added if they are separated by commas (CSV).
Ignore Subject Issue Keys IfIf the addressee matches a known project key and auto-assign is enabled, JEMH will ignore issue keys in the subject. This setting is off by default.

Email Threading

When JEMH processes an email, the emails message-ID is stored.  If a subsequent email refers to the original message-ID in its In-Reply-To/References headers, then issue association will occur.  Email thread matching behaviour can be disabled or modified via Profile>Email>Pre-processing. For more information, please see our page on Thread Matching.

...

For more information see the Regexp Field Processor page.

Script Field Processor

The Script Field Processor can be used to script a custom determination of what issue should be used to comment on based on anything you can code, and/or determine a particular processing outcome for a message.

The example mail below contains some text, including an issue key YY-4444, but the one we want is XX-2.  The javascript below uses a RegExp match, scoped to some expected specific projects, ABC, DEF and XX, so as to ignore YY.  Use of regexp capture groups  ( expr )  will return more matches, the first is always the whole expression match. So, here we use the extracted email payload through supplied variable body and test for a match.  If there is one, we the use the issueManager to lookup the related issue by key, and only if it exists, put the key in the $resultMap aginst "issueKey" to drive commenting on that issue.

Example Mail

No Format
MIME-Version: 1.0
Received: by 10.223.112.12 with HTTP; Sat, 18 Jun 2011 22:42:26 -0700 (PDT)
Date: Sun, 19 Jun 2011 17:42:26 +1200
Message-ID: <BANLkTinB1mfSh+GwOXGNWoL4SyDvOpdBoQ@mail.gmail.com>
Subject: This is a starting email template, update as required
From: "Andy Brook" <andy@localhost>
To: changeme@thiswontwork.com
Content-Type: text/plain; charset=UTF-8

some text

This was mentioned in custom project YY-4444 but we should put this on XX-2 for further review

more text

Example Script

No Format
if (relatedIssue != "null")
{
    print('no issue yet identified, scanning with script');
    
    // for testing
    //var body = "This was mentioned in custom project YY-4444 but we should put this on XX-22 for further review";

    var patt = new RegExp("(ABC|DEF|XX)-[0-9]+");
    var res=patt.exec(body); // This was mentioned in custom project YY-4444 but we should put this on XX-2 for further review
    
    if (res !== null)
    {
        if (issueManager.getIssueObject(res[0]) !==null)
        {
            resultMap.put("issueKey", res[0]);
            print('issueKey='+res[0]);
        }
        else
        {
            print('found match but the issue '+res[0]+' could not be found, one will be created')
        }
    }
    else
    {
      print('no issue keys found');
    }
}
else
{
    print('issue '+relatedIssue+' has already been identified through subject /other means');
}


By Email Address

The recipient address that matches one of the profile's catch email address is tested for a issue key. This association strategy can be enabled in the Profile→ Project Mapping → Issue configuration page.

...