An extension of the default email handler that allows users to define a new issue's project, type, priority, reporter, components... in the email message.
| Name | JIRA Advanced Mail Handler |
|---|---|
| Status | Stable |
| Version | 2.3 |
| Product Versions | JIRA 3.7 |
| Author | Daniele Raffo, CERN |
| Price | Free |
| License | BSD (see license) |
| Homepage | JIRA Advanced Mail Handler |
| Issue Tracking | http://developer.atlassian.com/jira/browse/JMH |
| JavaDocs | http://www.crans.org/~raffo/projects/jmh/javadocs |
| Download Bytecode | advanced-mail-handler-2.3.zip advanced-mail-handler-2.3.tar.gz |
| Download Source | advanced-mail-handler-src-2.3.zip advanced-mail-handler-src-2.3.tar.gz |
Description and Features
The JIRA Advanced Mail Handler is an extension of the standard JIRA email handler; it allows users to define many fields of the newly created issue (reporter, project key, type, priority, affected components, etc.) directly in the body of the email message. Hence, one of its notable features is that you do not need to repeat the whole process (opening a mail account on your mailserver, creating a mail account in JIRA, associate a handler service to the mail account and configure it) for each project you have in your JIRA installation; you just do the process once, setting a global mail account and handler service that will receive messages for all projects.
License
This software has been developed for CERN needs. It is available "as is" under BSD license and you are welcome to download and use it; however, neither CERN nor the author (I) can guarantee any support. I will however do my best to answer questions and help when I have the time: please write your question or feedback in the Comments section at the end of this wikipage, I will automatically be notified via email. Please also take some time to read the whole wikipage, including the comments – it may provide you the answer you are looking for.
Installation
To install the Advanced Mail Handler, follow these steps:
- Unzip the file archive and copy the compiled .class files into WEB-INF/classes/cern/jira/emailhandler/ (you might need to create the required directories);
- Add the following snippet of code to WEB-INF/classes/services/com/atlassian/jira/service/services/imap/imapservice.xml:
<value> <key>cern.jira.emailhandler.AdvancedCreateOrCommentHandler</key> <value>Advanced Mail Handler</value> </value> - Restart the JIRA server.
Configuration
Once the Handler is installed, you need to configure and activate it. This is done similarly as for the standard handler, as described in http://www.atlassian.com/software/jira/docs/latest/issue_creation_email.html: please read that page first, here I leave out some details and I describe only the steps that differ.
The procedure is as follows:
- Create an IMAP mail account, for instance issues@yourcompany.com. (The Handler probably works also on a POP account; however, I haven't tested it.)
- Add a new service: for Name, enter "Advanced Mail Handler"; for Class, select "Create issues from IMAP".
- Edit the newly created service: for Handler, select "Advanced Mail Handler"; for Handler Parameters, edit it as follows:
- The project parameter is the key of the default project. An issue is assigned to this default project if the user did not specify any project key, or specified an inexistent project key, in the email message. This parameter is optional, but I recommend to set it.
- The issuetype parameter is a number specifying the default issue type, and the association between numbers and issue types are explained in http://www.atlassian.com/software/jira/docs/latest/issue_creation_email.html#handler_params. An issue is assigned to this default type if the user did not specify the issue type in the email message. This parameter is mandatory.
- The jiraemail parameter must be set to the address of the IMAP account, in our example issues@yourcompany.com. This parameter is mandatory.
- If an alternate email address for jiraemail exists (for instance in the LDAP database of your company), the jiraalias parameter can be set to this alternate address. This parameter is optional.
- The other parameters are the same as the ones defined for the default handler.
Now click the Update button and the service will be operative.
Usage
To comment an already existing issue, the usage is the same as the default handler: just mention the issue number in the Subject: of the email message. The body of the email will become the comment on the issue. You can also send attachments with your email, which will become attachments on the issue (if attachments have been enabled in JIRA).
On the other hand, the Advanced Mail Handler allows you to define several fields when creating an issue. This is done by adding one or more tags in the text of the Subject: header, in the format #TAG-NAME=tag-value or #TAG-NAME=tag-value1,tag-value2,tag-value3.... The tag must not contain any space, i.e. there is no space character around the equal sign or the commas.
Project
You can specify the project in two ways:
- by addressing the message to project-key <issues@yourcompany.com>. This address can be put in the To:, Cc:, or Bcc: header at your choice.
- by adding the tag #PROJECT=project-key in the Subject: header. This overrides the project key in the address.
You always send the email to issues@yourcompany.com (or the address defined in the jiraalias parameter as well); what changes is that in the first way you add the project key as the Full Name part of the address.
For your comfort, you can create an entry in your addressbook for each project you're working on, with the project key as the Full Name and issues@yourcompany.com (which will be the same for all projects) as the Email Address.
If you do not specify a valid project, the issue is created in the default project defined as the project parameter.
Some mailclient (as Microsoft Outlook) does not give the user full control concerning the recipient address in the composing mail interface; for instance, if your company uses a LDAP database and issues@yourcompany.com has a record in it, these mailclients will not allow you to choose a Full Name for that email address and stubbornly put the Full Name defined in the database instead, no matter what you write. Also, some mailclient shows only the recipient Full Name and not the real email address, so it is difficult to tell who you are sending mail to. In this case you need to follow the second way and specify the project in the Subject: header. |
The jiraemail and jiraalias parameters have the purpose to ensure that a message was addressed to JIRA, so that spam does not go processed or, worse, ends up as an issue to the default project. If you see an ERROR [cern.jira.emailhandler.MessageParser] Jira email address not found amongst recipients in the logs, you specified these parameters incorrectly or you are sending the email message to the wrong address.
Summary
As with the standard handler, you write the summary of the issue in the Subject: of the email.
If you do not write any summary, the issue will be created with a summary text "(no summary)". However, it is recommended that you put a meaningful summary so all JIRA users can identify the issue.
The Subject: header can also contain several tags (as you will learn as you continue reading), which will not be included in the summary. These tags must be separated by spaces, and may be put in any order.
You should not use special characters (letters with acute/grave, diaeresis, tilde, etc.) in the subject line, or it may become corrupted. Please use only ASCII-7 characters.
Description
As with the standard handler, you write the full description of the issue in the body of the email.
You can also send attachments with your email, which will become attachments on the issue (if attachments have been enabled in JIRA).
Reporter
As with the standard handler, the reporter of the issue is identified as the sender of the email (you).
However, you might have more than one JIRA account associated with your email address, you might want to indicate another person as reporter, or you might be sending the email from another email account. In this case, you can explicitly specify the reporter by adding the tag #REPORTER=username in the Subject: header.
Assignee
As with the standard handler, the first Cc'ed person that is also a valid Jira user and a valid assignee for the concerned project becomes the assignee.
As one person can have multiple JIRA usernames associated with his email account, you can explicitly set the assignee's username by adding the tag #ASSIGNEE=username in the Subject: header. This overrides the Cc'ed assignee.
If you do not specify any valid assignee, the issue is assigned to the Default Assignee.
Issue type
You can specify the issue type by adding one of the following tags to the Subject: #BUG, #NEWFEATURE, #IMPROVEMENT, #TASK, or #SUBTASK.
If you do not specify it, the issue will be of the type specified in the issuetype parameter.
Priority
You can specify the priority of the issue by adding one of the following tags to the Subject: #BLOCKER, #CRITICAL, #MAJOR, #MINOR, or #TRIVIAL.
This option was managed by the default handler by looking at the X-Priority: header of the email, but I implemented it as such because many mailclients do not permit to set custom headers easily.
Components
You can associate an issue to one or more components of the project by adding the tag #COMPONENT=component-name to the Subject:. To specify multiple components, separate the components by a comma, as in #COMPONENT=first-component-name,second-component-name,third-component-name. Note that there is no space inside the whole tag.
If a component name contains any space, you must replace the space by two underscore characters. For instance, #COMPONENT=Test__Component associates the issue to Test Component.
If you specify no or invalid component, the issue gets associated by default to No Component.
Examples
| Example I The minimal email message you can send is summarized below: To: issues@yourcompany.com Subject: #PROJECT=XYZ Race condition A problem of race condition occurs when... etc. This creates an issue of type specified in issuetype and of default priority (usually Major), on the project that has key XYZ, summarized as "Race condition". To: XYZ <issues@yourcompany.com> Subject: Race condition A problem of race condition occurs when... etc. |
| Example II Let's say you want to issue an improvement request of critical priority on the component core-alarms of project ABC, summarize it as "Alert user when a buffer overflow is reported", and assign it to John Hacker (John.Hacker@cern.ch). To: issues@yourcompany.com Subject: #IMPROVEMENT #CRITICAL #PROJECT=ABC Alert user when a buffer overflow is reported #COMPONENT=core-alarms #ASSIGNEE=jhacker It is crucial to show a visual warning to the user in case of a buffer overflow... etc. Note that you can specify tags in any order and in any position, and they will not be included in the issue's summary. |
| Example III To comment issue ABC-7, simply write the following email: To: issues@yourcompany.com Subject: ABC-7 My comment on this issue is... etc. This is the usage of the standard JIRA email handler, and is left unmodified in the Advanced Mail Handler. |
Troubleshooting
If you cannot get the Advanced Mail Handler to work, try the following:
- Read again this instruction page and the comments; it is easy to miss something the first time.
- Examine the JIRA logs to see what is going wrong.
- Check the incoming email in the IMAP account (where the Advanced Mail Handler fetches the mail from).
- Try to uninstall the Advanced Mail Handler and to use the default mail handler instead. If it fails too, chances are that some of your JIRA components (email server, services, project keys...) are misconfigured. In this case, escalate the problem and ask the general JIRA support for help.
Tips and Tricks
If you prefer to have one email address for each project, like the standard email handler, just proceed as follows.
Create an IMAP email account for the first project, add a new service and associate the Advanced Mail Handler to it, as explained in the Configuration section above. Specify the email address as the jiraemail parameter and the project as the project parameter. Repeat the process for each project.
Third-Party Patches
David Leinbach wrote a patch that allows the user to specify the due date (given as YYYY-MM-DD) and the original estimate of the issue. For instance: #DUE=2008-04-14 #EST=1h.
You'll have to apply the patch on the original source code, then recompile it. Note that the Advanced Mail Handler was compiled on Java 1.4.2_12 for compatibility issues with Tomcat. You can find a Windows version of the patch tool as a part of the GnuWin32 package. (These instructions are given here for your convenience; I haven't tried them.)
Version History
2.3 (June 4, 2007): First public release.
Open Issues
Please see http://developer.atlassian.com/jira/browse/JMH. I do not foresee to release or work on a new version of the software at this moment.

Comments (49)
Jul 19, 2007
Frank Metzger says:
Using JIRA 3.10 Got an error while trying to load IMAP Mail.. 2007-07-...Using JIRA 3.10
Got an error while trying to load IMAP Mail..
2007-07-18 13:24:58,286 JiraQuartzScheduler_Worker-3 ERROR [service.services.mail.MailFetcherService] Throwable: java.lang.NullPointerException
java.lang.NullPointerException
at cern.jira.emailhandler.MessageParser.emailAddressToRegex(MessageParser.java:188)
at cern.jira.emailhandler.MessageParser.parse(MessageParser.java:38)
at cern.jira.emailhandler.AdvancedCreateOrCommentHandler.handleMessage(AdvancedCreateOrCommentHandler.java:92)
at com.atlassian.jira.service.services.mail.MailFetcherService.run(MailFetcherService.java:190)
at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:67)
at com.atlassian.jira.service.ServiceRunner.execute(ServiceRunner.java:61)
at org.quartz.core.JobRunShell.run(JobRunShell.java:191)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:516)
Here the settings:
Dienst bearbeiten: IMAP_ASS_TRANSFER
Geben Sie die Diensteigenschaften unten in Form von Textwerten ein. Leere Felder werden bei der Dienstinitialisierung auf NULL gesetzt.
Name des Ordners eingeben, aus dem gelesen werden soll. Leer lassen für Standard (INBOX).
Verzögerung in Minuten
Any Ideas?
Jul 24, 2007
Daniele Raffo says:
The error is due to the fact that the jiraemail parameter was not specified in H...The error is due to the fact that the jiraemail parameter was not specified in Handler Parameters.
Sep 25, 2007
mameha says:
To get this to work for POP, I simply add the snippet of code to the [blah]/pop/...To get this to work for POP, I simply add the snippet of code to the [blah]/pop/popservices.xml? Or is there something else required?
Oct 03, 2007
Daniele Raffo says:
You may try; I haven't tested it but I don't see why it should not work. Of cou...You may try; I haven't tested it but I don't see why it should not work.
Of course you also need to set up a POP mail account, and the Jira service must be of class "Create issues from POP".
Oct 27, 2007
Tennis Smith says:
Is there any way to add a fisheye link to an issue using this?Is there any way to add a fisheye link to an issue using this?
Oct 28, 2007
Daniele Raffo says:
I haven't been working with Fisheye recently, but if I do remember well, what yo...I haven't been working with Fisheye recently, but if I do remember well, what you want is done automatically by Jira/Fisheye basing on the tags in the source code repository (if you mention an issue number when doing a CVS commit, then that issue will automatically be linked to your changes in the source).
Oct 28, 2007
Tennis Smith says:
That's what I will normally do. This is a little different. I'm usin...That's what I will normally do. This is a little different. I'm using jira to track test case implementation. There are situations where I need to specify what test(s) are being implemented by a given function. To do that, I put a test name in the function's comments. Once done, I would like to point to the specific line in the code where a test is implemented. For example:
/*
* This is implementing testcase issue
* TEST-222
*/
I would then like to put something like this inside the TEST-222
issue comments:
http://fisheye/browse/foo.c?r=1.14#l101
I'd like to add these comments via your mail handler.
Oct 28, 2007
Peter Moore says:
Hi Tennis, JIRA 3.12 will have an Application Linker plugin that will simplify ...Hi Tennis,
JIRA 3.12 will have an Application Linker plugin that will simplify linking to FishEye. i.e. you will be able to define a pattern that gets converted to a deep link. For the moment the best idea is just to add a comment with the FishEye url in it.
I've raised FISH-107 to include content results in the FishEye tab. At the moment only content on Head/Trunk/Mainline is indexed though, so you probably still want to add permalinks as comments.
Cheers,
Pete
Oct 28, 2007
Tennis Smith says:
Thanks Peter. That will certainly help. Making all the links manually will be a...Thanks Peter. That will certainly help.
Making all the links manually will be a problem however. I'm about 1/4 of the way through my project and I already have just under 1000 links to add.
I'm thinking of try to do this via csv imports for now.
Thanks again
-Tennis
Oct 29, 2007
Tennis Smith says:
The handler appears to split any comment string with a newline at about column ...The handler appears to split any comment string with a newline at about column 70 or so. Is that expected? Can that value be changed? My preference would be for a newline at about column 120.
Thanks,
-T
Nov 20, 2007
Daniele Raffo says:
It is probably your mailclient that wraps text at column 70. Try changing the se...It is probably your mailclient that wraps text at column 70. Try changing the settings of your mailclient.
Oct 31, 2007
Ryan says:
Is there a way to pass custom field values in through the mail? For example, if ...Is there a way to pass custom field values in through the mail? For example, if I have a custom field: customfield_10005FieldArea with a value of "test value", can I pass that like I do for the other built in values like #ASSIGNEE=username ?
Nov 20, 2007
Daniele Raffo says:
No, the parser recognizes only the tags listed above. Sorry.No, the parser recognizes only the tags listed above. Sorry.
Nov 20, 2007
mameha says:
If you could add that function it would be very powerful. I need to impor...If you could add that function it would be very powerful.
I need to import issues form an external system somehow and populate custom fields. I tried using the excel POP parser extension (http://confluence.atlassian.com/display/JIRAEXT/Excel+POP+Parser+Handler) but I can't get it to work.
Dec 31, 2007
CYTEXONE says:
How difficult would it be to allow the parser to recognize custom fields? ...How difficult would it be to allow the parser to recognize custom fields? It would be so awesome.
Would you take donations to make this happen?
Jan 13, 2008
Daniele Raffo says:
Thank you, but actually I am busy with other projects and I have no time to work...Thank you, but actually I am busy with other projects and I have no time to work on the Advanced Mail Handler. I'm sorry.
Modifying the source code of the parser to recognize a custom field e.g. "customfield_10005FieldArea" would be quite straightforward: everything is done in MessageParser.parseSubject() and you would just need to add a new parsing rule, basing on the existing code.
However, you also need to manage a MutableIssue object to include your custom field and its value, and this is outside the scope of my parser.
Jun 11
Limwell Alim says:
hi mate, is there a possibility that this feature be on Advance mail handler? o...hi mate,
is there a possibility that this feature be on Advance mail handler? or could you suggest any workaround on how to do this. Thanks
Jun 11
Daniele Raffo says:
Hi, Well, I see no workaround for this apart from Java coding...Hi,
Well, I see no workaround for this apart from Java coding...
Nov 28, 2007
Matthew Lieder says:
Are the downloads valid ZIP files? I've been unable to open either of the f...Are the downloads valid ZIP files? I've been unable to open either of the files so far with any ZIP extractor I've tried...
Jan 13, 2008
Daniele Raffo says:
Yes, they are. Please try again – another user reported the same problem a...Yes, they are. Please try again – another user reported the same problem and eventually he was able to open them.
Anyway, I have now packaged the same files in gzipped tar archives, as an alternative to zipfiles.
Jan 16, 2008
Silvan Mühlemann says:
The default behaviour of the mail handler with cc'ed adresses is them to become ...The default behaviour of the mail handler with cc'ed adresses is them to become the assignee.
Is there a way to put them as watcher instead of as assignee?
Jan 20, 2008
Daniele Raffo says:
No, this feature is not implemented.No, this feature is not implemented.
Jan 18, 2008
wai yan says:
i cant extend this feature. Is there anybody who has successfully can use this f...i cant extend this feature. Is there anybody who has successfully can use this feature? please help me how to make it work. I set the parameter correctly. But it is not working.
Jan 22, 2008
Daniele Raffo says:
Hello Wai, 1) I have not tested the handler with POP – just with IMAP. 2)...Hello Wai,
1) I have not tested the handler with POP – just with IMAP.
2) Check that you have specified the correct name for your POP server.
3) Check that the mail account JIRA fetches messages from (jira@tesing.com) is correct and accessible.
4) Read the JIRA logs to know exactly why it is not working.
Feb 04, 2008
Sophie Wong says:
Is there a way to update an existing issue using this handler? I would like to r...Is there a way to update an existing issue using this handler? I would like to reassign an issue or even close an issue via an email.
Feb 14, 2008
Daniele Raffo says:
No, you can just create or comment an issue – like the original email hand...No, you can just create or comment an issue – like the original email handler allowed to do.
Mar 07, 2008
Daniele Raffo says:
Received from an user and posted here (with her consent) for the benefit of the ...Received from an user and posted here (with her consent) for the benefit of the other users. My reply is below.
We have two Helpdesks, IT and SYSTEMS. Issues are sent to the specific mailbox and the technician solves the problem from the mailbox.
I want to create the issues in each of the mailboxes as issues in separate projects. Jira, however, can only handle one mailbox. I know I can use your Advanced Handler to create issues in different projects.
However, the issues in the two Helpdesks are confidential per Helpdesk, thus the messages cannot be merged into one mailbox for the issues to be created in Jira.
I have overcome that by creating a rule in mailbox IT and another rule in mailbox SYSTEMS to forward the mail to a Jira mailbox (not accessible by the users) with the text attach to the subject as #PROJECT=SYSTEMS or #PROJECT=IT, depending where the mail comes from.
Unfortunately our mail client add the text at the end of the subject, for ex: FWD:Printer Problem (#PROJECT=IT).
The Advanced Email Handler only reads the text if it is first in the subject (for example: #PROJECT=IT Printer problem) and then adds it to the correct project.
Is there a way that the Advanced Email Handler can pick up the #PROJECT, even if it is not the first text in the subject or do you have another solution for me? I unfortunately cannot change the email subject text.
To solve your problem you can create two email accounts (one for IT and one for SYSTEMS) in Jira, and two different Advanced Mail Handler services. Each service will fetch only email collected in its own account. Remember to set the default project for each account (i.e. IT and SYSTEM respectively) so you do not need to specify it in the Subject.
Note that it is not true that the tags need to be first in the Subject text. You can specify tags in any order, so "#PROJECT=IT Printer problem" and "Printer problem #PROJECT=IT" and even "Printer #PROJECT=IT problem" are equivalent and will all work. The Advanced Mail Handler cannot find the project tag in your example because it is surrounded by parenthesis.
Mar 31, 2008
Neeraj Jhanji says:
Does this plugin work on JIRA 3.12.2? We installed it but are having problems wh...Does this plugin work on JIRA 3.12.2? We installed it but are having problems when trying to configure it.
Apr 07, 2008
Daniele Raffo says:
Hi Neeraj, I developed and tested the handler under Jira v3.7, I don't know abo...Hi Neeraj,
I developed and tested the handler under Jira v3.7, I don't know about compatibility issues with v3.12. Maybe someone can share its experience.
Which problem do you have exactly?
Apr 04, 2008
Neeraj Jhanji says:
Hello Daniele, When we tried to install the Advanced Mail Handler on JIRA 3.12....Hello Daniele,
When we tried to install the Advanced Mail Handler on JIRA 3.12.2, it seemed to interfere with JIRA's built-in Create/Comment Handler. After installing it (and making the necessary changes to the XML files), it was no longer possible to add any new services to JIRA and began to throw a nullpointer exception: "Error adding service: java.lang.NullPointerException". The problem was fixed by removing the Advanced Mail Handler.
We would like to use if you can make sure it works on JIRA 3.12.2 and an in unison with the built-in email handler. Could you please update your code for that?
best regards,
Neeraj
Apr 07, 2008
Daniele Raffo says:
This is strange. Have you tried to add the Advanced Mail Handler as the last ser...This is strange. Have you tried to add the Advanced Mail Handler as the last service? Or to use just one Handler?
I am busy with other projects, therefore I cannot currently plan to do further development/testing on the Advanced Mail Handler. However, the full source code is available for those who want to take the challenge. That's all I can suggest at the moment. Sorry to disappoint you.