Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
maxLevel2

Introduction

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

Note

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)

Info

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:

Note

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.

  • Go to JEMH>Profiles and configure your chosen profile

  • Go to the Project section and click Edit

  • Click New Project Mapping

  • Select the Project that you want

  • We are now going to set a value for our custom address, so that when this project mapping is used the custom field will be given this value:

Info

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.

  • Click Submit to save the changes, then click edit again on the mapping

  • Scroll to the bottom and click New Domain Mapping, New Group Mapping or New Keyword Mapping

  • In this example, we will create a simple domain mapping rule that maps issues to our project when they are from a particular address:

  • Click Submit to save the changes

Event Listener setup

Note

This guide assumes that you already have the event listener enabled and basic settings configured to your needs.  See How Do I Use Event Listener for Issue Events 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.

  • Go to JEMH>Event Listener

  • Click Edit on your project event listener mapping

  • You will see a From: and Reply To: section.  We are focussing on the From address, however both can be set up in the same way by following this guide

  • For the setting Custom From: Custom Field, select the custom field that we gave a value in the profile project mapping

  • The Personal (name) used by the outgoing mail can also be set with either a custom field or a static text entry

  • Here is what our set up looks like:

  • Click Submit to save all changes

Result

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

Custom From Address for Issue Creation Notifications (JEMH Profile driven notifications)

This method uses the JEMH profile to enable creation and comment notifications to have a different From address. The following example will show a Jira and a non-Jira user email triggering an issue creation and being notified of its creation.

Note

This method is more restrictive than using the event listener as with this method you are limited to only changing the From address on the ISSUE_CREATED notification. These notification can only be sent to following users as listed under Profile > Notification > Notify Users on Issue creationNon-Jira senderJira sender, All (sender, to: and cc: ) and Sender (only).

JEMH Profile Settings

Profile > Email > Addresses

Enter the desired From: address and name into the Custom From: email and Custom From: email name part fields in Profile > Email.

Image RemovedImage Added

Profile > Notifications

Set the Notify Users on Issue Creation option to Sender under Profile > Notifications.

Image RemovedImage Added

Expected outcome

The following recipients should all receive an issue created event from the custom address ppl.test.address@gmail.com.  The default email address ppl.1.email@gmail.com should only be mentioned in email headers.

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 'test':

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

Image RemovedImage Added

JIRA User

The Jira notification is the same.

Image RemovedImage Added

Filter by label (Content by label)
showLabelsfalse
max5
spacesJEMH
showSpacefalse
sortmodified
typepage
reversetrue
labelsevent listener jemh issue notification
cqllabel in ( "notification" , "notifcations" , "event" , "listener" , "customfield" ) and space = "JEMH"
Page Properties
hiddentrue

Related issues