Custom Emails
If built-in Email notifications are not enough, you can customize emails sent when something happens to your Environments:

Create an Automation

The first step is to create a new Automation (as explained here: Automations):
For Email automations, you need to set the list of recipients that can be both static (ex: a known distribution list) or dynamic (to Jira users members of given groups).

Custom Subject and Content

Enable the "Custom Message" toggle in order to customize content of your Email messages. Start from the provided default template to build your own custom templates:
Example of dynamic subject:
1
Environment {{environment.application.name}} {{environment.category.name}} has been updated by {{user.displayName}}
Copied!
Example of dynamic HTML e-mail:
1
{% macro displayProperty(propertyName, propertyValue) %}
2
<td width="160" valign="top" style="padding: 0px 0px 2px 0px;font-family: Helvetica, Arial, sans-serif;">
3
<b>{{ propertyName }}:</b>
4
</td>
5
<td width="400" valign="bottom" style="padding: 0px 0px 2px 0px;font-family: Helvetica, Arial, sans-serif;">
6
{% if propertyValue is not null %}
7
{{ propertyValue }}
8
{% else %}
9
none
10
{% endif %}
11
</td>
12
{% endmacro %}
13
14
<html xmlns="http://www.w3.org/1999/xhtml">
15
<head>
16
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
17
<title>Environment Manager Notification</title>
18
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
19
</head>
20
<body style="margin: 0; padding: 0;">
21
<table align="center" border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse;margin-top:20px">
22
<tr>
23
<td bgcolor="#f5f5f5" style="padding: 20px 30px 20px 30px;">
24
<table border="0" cellpadding="0" cellspacing="0" width="100%">
25
<tr>
26
<td>
27
<h2 style="font-family: Helvetica, Arial, sans-serif;">
28
Updated Environment: {{environment.application.name}} {{environment.category.name}}
29
</h2>
30
</td>
31
</tr>
32
</table>
33
</td>
34
</tr>
35
<tr>
36
<td bgcolor="#ffffff" style="padding: 40px 30px 20px 30px;">
37
<h3 style="font-family: Helvetica, Arial, sans-serif;">What has changed?</h3>
38
<table border="0" cellpadding="0" cellspacing="0" width="560">
39
{% for change in environmentChanges %}
40
<tr>
41
{% if change.toString is not null %}
42
{% set newValue = change.toString %}
43
{% else %}
44
{% set newValue = "-" %}
45
{% endif %}
46
{% if change.fromString is not null %}
47
{% set value = newValue + " (was " + change.fromString + ")" %}
48
{% endif %}
49
{{ displayProperty(change.field, value) }}
50
</tr>
51
{% endfor %}
52
</table>
53
</td>
54
</tr>
55
<tr>
56
<td bgcolor="#ffffff" style="padding: 40px 30px 20px 30px;">
57
<h3 style="font-family: Helvetica, Arial, sans-serif;">Details</h3>
58
<table border="0" cellpadding="0" cellspacing="0" width="560">
59
<tr>
60
{{ displayProperty("URL", environment.url) }}
61
</tr>
62
<tr>
63
{% if environment.status is not null %}
64
{% set statusName = environment.status.name %}
65
{% endif %}
66
{{ displayProperty("Status", statusName) }}
67
</tr>
68
<tr>
69
{% if environment.deployment is not null %}
70
{% set versionName = environment.deployment.versionName %}
71
{% endif %}
72
{{ displayProperty("Deployed", versionName) }}
73
</tr>
74
</table>
75
</td>
76
</tr>
77
<tr>
78
<td bgcolor="#ffffff" style="padding: 40px 30px 20px 30px;">
79
<h3 style="font-family: Helvetica, Arial, sans-serif;">Attributes</h3>
80
<table border="0" cellpadding="0" cellspacing="0" width="560">
81
{% for attribute in environment.attributes %}
82
<tr>
83
{{ displayProperty(attribute.key, attribute.value) }}
84
</tr>
85
{% endfor %}
86
</table>
87
</td>
88
</tr>
89
</table>
90
</body>
91
</html>
Copied!
You can customize your email Subject and Body with static or dynamic content using expressions, conditions and loops (Pebble Templates).

Preview and Test custom Emails

Click on the “eye icon” button next to the field to process with the parameters of your Example Environment.
In order to test your Automation, choose an Example Environment and click on the Test button:

Useful Resources

Pebble Templates
Last modified 6mo ago