This page is a user maintained page of recipes for various things you can do with the Email-ext plugin for email notifications.
Additional Templates In the Source Code
The "Jelly content" and "Script content" contain links to html.jelly, text.jelly, groovy-html.template and groovy-text.template files. They are quite simple ones, and for example do not contain code coverage template. On the other hand the "Template Examples" section contain link to only one file, which it too advanced for me, and didn't actually work for some reason.
Anyway it took me some time to discover that more templates are actually available at https://github.com/jenkinsci/email-ext-plugin/tree/master/src/main/resources/hudson/plugins/emailext/templates . It would be nice it the wiki page contained either a link to this directory or links to remaining files from the directory, could you please add it?
Set Message As Important
I wanted to mark failure messages as important ones. I found on google this comment https://issues.jenkins-ci.org/browse/JENKINS-13912?focusedCommentId=163420&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-163420, saying that it is possible the pre-send script feature, however the comment does not explain how to do it. The "Pre-send script" section contain a link to the MimeMessage API, but fails to include links to the two other objects (Build, which is especially important for testing if build failed, and PrintStream) - would it be possible to add them? Additionally it would be nice if the wiki page included some sample script, showing how to use it.
Anyway it turned out that adding headers is quite easy, and I've finally ended with this simple script:
Filter Recipients On Domain
The script below will filter out the recipients that DO NOT contain '@gooddomain.com'
Filter Recipients On White List
The script below will filter out the recipients that DO NOT contain one of the defined white list values
Post-send scripts are available starting with version 2.41.
Use rewritten Message-ID from AWS SES for In-Reply-To header
The Amazon Simple Email Service (AWS SES) rewrites the Message-ID header of outgoing emails. That means subsequent failure/success notifications will not be in the same thread, because they reference a non-existing message id in the In-Reply-To header.
The rewritten message id is returned as last message of the SMTP transaction, e.g.
The following post-send script fetches the rewritten message id for later correct In-Reply-To headers: