This script will be run prior to sending the email to allow modifying the email before sending. The MimeMessage variable is msg, the build is available as build, a logger is available as logger. The trigger that caused the email is available as trigger and all triggered builds are available as a map triggered.

You may also cancel sending the email by setting the boolean variable cancel to true.

You can set the default pre-send script here and then use ${DEFAULT_PRESEND_SCRIPT} in the project settings to use the script written here.