Introduction

You wish to set a custom From email address for your issue notifications.

In order for JEMH to successfully use a custom From address, the outgoing mail server being used must have the necessary configuration and/or permissions to send emails using that email address.

Example configuration

SMTP Server (in/out)

ppl.1.email@gmail.com

Jira user address (initiator)

jemhtesting2@gmail.com

Non-Jira user address (initiator)

jemhtesting3@gmail.com

Here, the Jira outbound mail server is showing the default from: address as ppl.1.email@gmail.com. It is this address that we will override.

Custom From address for Notifications for each Project Mapping/Project Mapping Rule (Event Listener driven notifications)

Possible with JEMH 1.7.x+

This method uses custom fields and the event listener to enable issue notifications to have a different From address depending on what project mapping or project mapping rule was used.  This allows a fine grained approach to configuring event notifications.  See How Do I Use Project Mappings for more information on how project mappings can be used.

Custom Field setup

If not already set up, create a Single Line Text Field type custom field.  This will be the custom field that holds our custom email address:

Ensure that your custom field is:

  • in the scope of the projects and issue types used

  • enabled in the field configuration associated with issues from your project

You can check this by using the "Where is my field?" functionality on an existing issue in your project. This is found under the "Admin" controls found next to the issue workflow actions.  Note that the field doesn't have to be visible in order to be used.

Profile setup

Next, we will configure our JEMH profile.  We are going to add a project mapping to the profile, then add a rule to the mapping.

Static Value

Dynamic Value

Its possible to extract the ‘mailbox’ address that the mail was sent to (referred to as the Catchemail address), to do this, a Dynamic velocity script needs to be used:

The custom field we are using can be set at either project mapping level, or project mapping rule level.  Setting the custom field at project mapping level means that when an incoming issue is associated with the project, it has that custom field value regardless of the rule used to associate.  Setting the custom field at project mapping rule level means that the custom field value can be set differently depending on what mapping rule is used to make the project association.

Event Listener/Notifications setup

This guide assumes that you already have the event listener/Notifications enabled and basic settings configured to your needs.  See Use Event Listener for Issue Events (now the 'Notifications' section) for more information on the configuration of the Event Listener.

We will now set up our project's Event Listener mapping in order for it to use the custom field.  We will be setting up the custom From address for the non-Jira user notifications. The same steps can also be applied for Jira user notifications.

Result

For issue creation and other subsequent events, the custom email address is used for notifications.

Test case

The following test case is from: the non-Jira user, to the inbox address.

Created issue

Expected result of both the Jira and non-Jira user test cases:

 

The issue created with the Jira user has the reporter ‘jemh’ (a Jira account) and the issue created by the non-Jira user was created by the Default User 'admin':

Determining the From address

Personal
  1. If a configuration could be located and a custom Name is defined, use it, i.e. Custom Name in this example

  2. Failing this, the 'name' of the remoteUser making the change would be used

  3. Failing that, the 'name' taken from the senders email address would be used

Address
  1. If a Configuration could be located and a custom Email address is defined, use it, i.e. ppl.test.address@gmail.com in this example

  2. If not found, the project email address is used

  3. If not found, the server default address is used.

At this point, the sender will be "Custom Name" <ppl.test.address@gmail.com>

Examining the received emails

Non-Jira User

The Non-Jira notification shows the updated sender personal and address components, as defined within the Profile.

JIRA User

The Jira notification is the same.

Related articles

Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.

Related issues