How to configure Jenkins editable email notification?

Sameera De Silva
2 min readDec 18, 2023

--

The requirement -

After a build, I want to send an email as a sender , to a receiver’s email address ,also with a reply to list.

Solution-

In Jenkins there is a dedicated email configuration under “Post-build Actions”.

So let’s use it.

This field specifies the sender’s email address for the email notification.
It is the “From” address that recipients will see when they receive the email.
You can usually set it to a specific email address or use a variable that represents the build user’s email.

Project Recipient List:
This field defines the list of email addresses that will receive the notifications. You can enter email addresses directly in this field or use variables to dynamically determine the recipients based on the build status or other conditions.

Project Reply-To List:

The Reply-To List allows you to specify one or more email addresses to set the “Reply-To” header in the email.
When a recipient clicks “Reply” to the email, their email client will use the address specified in the “Reply-To” header. This can be useful if you want replies to go to a different address than the “From” address.

So we can map the fields as
Project From: your_email@example.com
Project Recipient List: myrecepient@gmail.com
Project Reply-To List: (optional, if you want replies to go to a different address)

Content type should be Default content type.

To use build number and build status ,we can use the available tokens and variables provided by Jenkins $BUILD_NUMBER — $BUILD_STATUS

MyJobTestResults Jenkins Build $BUILD_NUMBER - $BUILD_STATUS

To the email body , we can use Default Content field to add content.

Also we can attach the build log, if it’s not that large.

Useful inbuild Jenkins parameters are given with $

Job: $JOB_NAME
Status: $BUILD_STATUS
Build Number: $BUILD_NUMBER
URL: $BUILD_URL

Also we can attach files, here my filename is chaging after SingleExecutionReport_ . So I used * sign.

MainDirectory/subdirectory/SingleExecutionReport_*.html

--

--

No responses yet