How to route emails to projects
Sometimes it is required for a single Mail Handler to create issues not only in a single project but in several ones based on some email attributes. Email This Issue Mail Handler along with its support to initialize issue fields provide an easy solution for this.
To implement email routing, first set up a mail handler by following the "Configure Mail Handler to Process Emails" section in the corresponding tutorial: Setting up an Email Help Desk.
Configure the mail handler by enabling the option: "Initialize Issue Fields":
Then add a new Field Context that covers your project or projects of the mail handler:
Configure the Field Context by adding field rules for each possible sender domains with the following attributes:
Field Rules of these type will implement email routing based on the sender's email address.
However, following the same logic, you can route emails to different projects also based on recipient addresses, email subject and body content etc.
Project routing works if the issue type (and the corresponding workflow) is the same in all projects to which the routing is configured.
If you successfully routed your emails to different projects, you may want to comment the issues from any subsequent emails via the same Mail Handler.
In order to make this work for you, you will have to do either of the following:
- Configure your mail handler with the Project field left empty, this will mean that the Mail Handler is applied to all projects
- Configure mail handlers for each Project you are routing to.
Note: This does not require you to set up different email accounts and mail handlers in Jira, only in Jira Email This Issue.
Similarly, if you want to initialize issue fields or execute workflow transitions for subsequent emails that are related to issues, make sure your Field Context includes the projects or add Field Contexts for each projects you are routing to.