Custom HTML in templates

To learn about template management, head to the documentation page dedicated to templates.

Using custom HTML in a template

⚠️ This page is an advanced configuration option for PageMailer. You may want to refrain from using it if you are not familiar with HTML & CSS.

Within the modal to Edit a template, scroll all the way down, and you will find this option:

Option to enable custom HTML
Option to enable custom HTML

Once the option is enabled, you should see the following:

Custom HTML is enabled
Custom HTML is enabled

Notes:

  • Disabling the Custom HTML option will delete any changes made to the HTML & CSS of the template. Please make sure you are saving a copy outside of PageMailer.
  • You are advised to copy the contents of the text area into an IDE or code editor, and paste it back into PageMailer when done.
  • If you need to come back to this documentation page, you should find the link directly under the text area when Custom HTML is enabled.
  • PageMailer uses a templating syntax in templates to support conditions, loops and variables. Head to the next section for more details.

Templating syntax within the template’s HTML

Within the HTML of a template, PageMailer uses templating which offers support for conditions, loops and variables, to manage styles depending on which attributes are configured or to loop over links added to the footer. In order to use this syntax yourself, please refer to the following:

Variables

The syntax for variables is as follows: {{variableName}}.

Here is the list of supported variables, which match what is configurable within the templates:

  • {{headerLogo}} – Use in src
  • {{headerLogoLink}} – Use in href
  • {{title}}
  • {{subtitle}}
  • {{page}}Note: not part of the configuration, this contains the rendered Confluence page as HTML
  • {{footerLogo}} – Use in src
  • {{footerLogoLink}} – Use in href
  • {{signature}}
  • socialLinks – To be looped over, contains the following fields:
    • {{this.link}} – Use in href
    • {{this.logo}} – Use in src
    • {{this.network}} – Use in alt
  • footerLinks – To be looped over, contains the following fields:
    • {{this.link}} – Use in href
    • {{this.label}}

Conditions

Condition
1
2
3
{{#if headerLogo}}
    <img class="logo" src="{{headerLogo}}" />
{{/if}}
Reverse condition
1
2
3
{{#unless headerLogo}}
    <span>No logo was selected</span>
{{/unless}}

Loops

Loop
1
2
3
4
{{#each footerLinks}}
    <a href="{{this.link}}">{{this.label}}</a>
    {{#unless @last}}|{{/unless}}
{{/each}}

Within a loop, you have access to the following special variables:

  • @index
  • @first – true when on the first iteration
  • @last – true when on the last iteration

Modifiers

Available modifiers
1
2
3
4
5
<!-- Specify a default value -->
{{default colors.headerText "#000000"}}

<!-- Make a string uppercase -->
{{uppercase title}}

Custom CSS

When writing your own template’s HTML, you may want to also specify custom CSS. PageMailer’s rendering works by taking styles available within the HTML document inside of a <style>...</style> element, and applying the styles inline before sending the email. This is done to maximize email client support.

Below are PageMailer’s default styles, used for the base rendering of a Confluence page. You may want to also take a look at supported Confluence macros to get a sense of what each class is used for. You can override the style of any of these classes directly in the template’s CSS.

Full stylesheet

Note: this sheet is subject to change as support for new Confluence macros is expanded.

PageMailer stylesheet
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
a {
    color: #0052cc;
    text-decoration: underline;
}

p {
    font-size: 1em;
    line-height: 1.714;
    font-weight: normal;
    margin-top: 0.75rem;
    margin-bottom: 0;
    letter-spacing: -0.005em;
    word-break: break-word;
}

ul,
ol {
    padding-left: 25px;
}

h1 { margin-top: 1.45833em; }
h2 { margin-top: 1.4em; }
h3 { margin-top: 1.31249em; }
h4 { margin-top: 1.25em; }
h5 { margin-top: 1.45833em; }
h5 { margin-top: 1.59091em; }

p:first-child,
ul:first-child,
ol:first-child,
h1:first-child,
h2:first-child,
h3:first-child,
h4:first-child,
h5:first-child,
h6:first-child,
.layout-section {
    margin-top: 0;
}

h1 a,
h2 a,
h3 a,
h4 a,
h5 a,
h6 a {
    text-decoration: none;
}

ul:last-child,
ol:last-child {
    margin-bottom: 0;
}

hr {
    border: none;
    background-color: #ecedf0;
    margin: 1.7em 0px;
    height: 2px;
}

table.table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 8px 0px 0px;
    border: 1px solid #c1c7d0;
}
    table.table td,
    table.table th {
        position: relative;
        text-align: left;
        min-width: 48px;
        font-weight: normal;
        vertical-align: top;
        border-width: 1px 0px 0px 1px;
        border-style: solid;
        border-color: #c1c7d0;
        border-image: initial;
        padding: 8px;
        background-clip: padding-box;
    }

blockquote {
    border-left: 1px solid #ccc;
    margin-left: 19px;
    padding: 10px 20px;
}

.jira-status {
    background-color: #dfe3e6;
    color: #42526e;
    box-sizing: border-box;
    max-width: 100%;
    padding: 3px 4px 1px 4px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    vertical-align: baseline;
    display: inline-block;
}

.inline-card {
    color: #0052cc;
    text-decoration: none;
    padding: 0 0.24em 3px;
    background-color: white;
    border-radius: 4px;
    border: 2px solid #e4e7ea;
}
    .inline-card span,
    .inline-card .icon {
        vertical-align: middle;
    }

.block-card {
    margin-top: 12px;
    background-color: white;
    border-radius: 8px;
    border: 1px solid #dfe1e6;
    overflow: hidden;
    width: 100%;
}
    .block-card .block-contents {
        padding: 16px;
        font-size: 12px;
    }
        .block-card .block-contents > * {
            margin-top: 15px;
        }
        .block-card .block-contents .title {
            margin-top: 0;
            font-size: 16px;
        }
            .block-card .block-contents .title > a {
                text-decoration: none;
            }
            .block-card .block-contents .title > img.icon {
                width: 24px;
            }
    .block-card .block-contents a,
    .block-card .block-contents span,
    .block-card .block-contents .icon {
        vertical-align: middle;
    }
    .block-card .block-contents .site-name {
        color: #626f86;
    }
        .block-card .block-contents .site-name > span {
            margin-left: 3px;
        }
    .block-card .image {
        width: 30%;
        background-size: cover;
        background-position: center;
    }

img.icon {
    width: 18px;
    vertical-align: text-top;
}
    h1 img.icon {
        width: 25px;
        vertical-align: baseline;
    }
    h2 img.icon {
        width: 25px;
    }
    h3 img.icon {
        width: 22px;
    }
    h5 img.icon {
        width: 15px;
    }
    h6 img.icon {
        width: 12px;
    }

.figure {
    margin-left: 0;
    margin-right: 0;
}
    .figure > div {
        display: inline-block;
    }

img.attachment {
    max-width: 100%;
}

.figcaption {
    margin-top: 8px;
    text-align: center;
    color: #505f79;
}

.mention {
    display: inline-block;
}
    .mention > img {
        border-radius: 11px;
        vertical-align: middle;
        width: 22px;
        height: 22px;
    }
    .mention > .username {
        color: #172b4d;
        font-weight: bold;
        vertical-align: middle;
        text-decoration: none;
    }

code {
    font-size: 0.875em;
    font-family: SFMono-Medium, 'SF Mono', 'Segoe UI Mono', 'Roboto Mono', 'Ubuntu Mono', Menlo, Consolas, Courier, monospace;
    font-weight: normal;
    background-color: #ecedf0;
    color: #172b4d;
    border-style: none;
    border-radius: 3px;
    display: inline;
    padding: 2px 0.5ch;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    overflow: auto;
}

.codeblock {
    background-color: #f4f5f7;
    padding: 8px;
    border-radius: 3px;
    margin-top: 0.75rem;
    font-size: 14px;
    line-height: 125%;
}
    .codeblock:first-child {
        margin-top: 0;
    }
    .codeblock pre {
        margin: 0;
        white-space: pre-wrap;
        word-break: break-word;
    }

.status {
    display: inline-block;
    box-sizing: border-box;
    max-width: 100%;
    padding: 3px 0px 3px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    vertical-align: middle;
    /* Default color = neutral */
    background-color: #dfe1e6;
    color: #42526e;
}
    .status > span {
        display: inline-block;
        box-sizing: border-box;
        width: 100%;
        padding: 0px 4px;
        overflow: hidden;
        text-overflow: ellipsis;
        vertical-align: top;
        white-space: nowrap;
    }
    .status.status-purple {
        background-color: #eae6ff;
        color: #403294;
    }
    .status.status-blue {
        background-color: #deebff;
        color: #0747a6;
    }
    .status.status-red {
        background-color: #ffebe6;
        color: #bf2600;
    }
    .status.status-yellow {
        background-color: #fff0b3;
        color: #172b4d;
    }
    .status.status-green {
        background-color: #e3fcef;
        color: #006644;
    }

.task-list {
    margin-top: 12px;
}
    .task-list:first-child {
        margin-top: 0;
    }
    .task-list > .task-list {
        margin-top: 0;
        margin-left: 24px;
    }

.task-item {
    display: flex;
    flex-direction: row;
    padding: 3px 3px;
    position: relative;
}
    .task-item .checkbox {
        flex: 0 0 16px;
        width: 16px;
        height: 16px;
        position: relative;
        align-self: start;
        margin: 1px 8px 0 0;
    }
    .task-item .text {
        margin: 0px;
        overflow-wrap: break-word;
        min-width: 0px;
        flex: 1 1 auto;
        line-height: 1.714;
    }

.decision-list {
    margin-top: 12px;
}
    .decision-list:first-child {
        margin-top: 0;
    }

.decision-item {
    display: flex;
    flex-direction: row;
    padding: 6px;
    padding-left: 10px;
    position: relative;
    background-color: #f1f1f2;
    border-radius: 3px;
    margin-top: 8px;
    min-height: 27px; /* For when the item is empty (no text) */
}
    .decision-item:first-child {
        margin-top: 0;
    }
    .decision-item .icon {
        flex: 0 0 16px;
        width: 16px;
        height: 16px;
        position: relative;
        align-self: start;
        margin: 2px 8px 0 0;
    }
    .decision-item .text {
        margin: 0px;
        overflow-wrap: break-word;
        min-width: 0px;
        flex: 1 1 auto;
        line-height: 1.714;
    }

.panel {
    border-radius: 3px;
    padding: 8px;
    min-width: 48px;
    display: flex;
    position: relative;
    align-items: baseline;
    word-break: break-word;
    margin-top: 0.75rem;
    /* Default background color = note */
    background-color: #eae6ff;
}
    .panel:first-child {
        margin-top: 0;
    }
    .panel.panel-info {
        background-color: #deebff;
    }
    .panel.panel-error {
        background-color: #ffebe6;
    }
    .panel.panel-warning {
        background-color: #fffae6;
    }
    .panel.panel-success {
        background-color: #e3fcef;
    }
    .panel .panel-icon {
        flex-shrink: 0;
        width: 24px;
        box-sizing: content-box;
        padding: 2px 8px 0 4px;
        text-align: center;
        user-select: none;
    }
    .panel .panel-content {
        margin: 1px 0px;
        flex: 1 0 0px;
        min-width: 0;
    }

.media-group > *,
.media-inline {
    color: #435b85;
    font-weight: bold;
    padding-right: 5px;
    display: inline-block;
}
    .media-group > * img,
    .media-inline img {
        max-height: 22px;
        padding-right: 0;
        vertical-align: middle;
    }
    .media-group > * + * {
        margin-left: 5px;
    }

.date {
    background: #ecedf0;
    border-radius: 3px;
    color: #172b4d;
    padding: 2px 4px;
    margin: 0px 1px;
}

.layout-section {
    display: flex;
    flex-direction: row;
    margin-top: 1.25rem;
}
    .layout-column {
        flex: 1 1 0%;
        min-width: 0px;
    }
    .layout-column + .layout-column {
        margin-left: 32px;
    }

.expand {
    border: 1px solid #dddedd;
    border-radius: 4px;
    padding: 8px 12px;
    margin-top: 0.75rem;
}
    .expand:first-child {
        margin-top: 0;
    }
    .expand > .expand-title {
        color: #505258;
        font-weight: 400;
        font-size: 0.875rem;
        margin-bottom: 8px;
    }