"Mail" Step for Jenkins Workflow

There are a number of great Jenkins plugins that provide email send/notification capabilities. These all work really well with traditional Jenkins Job types (Freestyle, Maven etc), not only handling the composition and sending of an email, but also make decisions around when/if that email should be sent based on the state of previous runs of the Job in question etc.

The nature of a Workflow Job is different from other build types in that the Job author has more direct control and visibility into the “flow” and state of the job. They are able to script the Job flow and monitor its state directly in the Workflow DSL (Groovy). For that reason, it makes sense to also provide a straight-forward mail step for Workflow that simply sends an email i.e where there’s no magic around email composition or scheduling of the send.

This is what the new mail step does for Jenkins Workflow. It’s built on top of the mailer-plugin, but provides a more logical interface for Workflow job types that simply want to send an email e.g.

As usual, the Snippet Generator is the best way to investigate all the options available for this and other Workflow build steps.​

Tom Fennelly

Stay up to date

We'll never share your email address and you can opt out at any time, we promise.