Send a custom email (non-issue events)
Use this listener to send an email based on a Jira non-issue event and custom condition. Non-issue events include:
- Create a project
- Add a new user
- Update a component
- Third-party plugin events
This listener has multiple elements to it:
- Applied to: Choose if you want to apply this listener to specific or all projects in your instance.
- Events: Choose the non-issue event/s this listener will fire on.
- Condition and configuration: Set a condition to control when this listener fires. You can also pass additional variables to the body and subject templates using the
configmap, and dynamically control recipients using themailvariable. See Send a custom email for more information on configuring custom emails. - Email template: Write an email template using plain text or the GStringTemplateEngine.
- Subject template: Write the subject template using plain text or the GStringTemplateEngine.
- Email format: Choose whether to send the email as plain text or HTML.
- To addresses/To Groups: Choose who to send the email to.
- CC addresses/CC Groups: Choose who should be CC'd on the email.
- Reply-to email address: Set the email address for replies.
Condition and configuration example
In the Condition and configuration code editor you can enter a condition to ensure certain conditions are met before the email is sent. You can also use this code editor to pass additional variables to the Email template and Subject template using the config map, and dynamically control recipients using the mail variable. For example, we want to send an email after a version is released. In this example, the selected event will be VersionReleaseEvent and the script in the Condition and Configuration field will be:
import com.atlassian.jira.event.project.VersionReleaseEvent
def versionReleaseEvent = event as VersionReleaseEvent
def version = versionReleaseEvent.version
// Store in the config map, the version and the project name so we can use them later in our templates
config.'versionName' = version.name
config.'projectName' = version.project.name
trueWe can use the above variables in our Email and Subject and templates, for example the Email template would be:
Version $config.versionName for project $projectName just released.
Congratulations!