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 also available as build and a logger is available as logger.

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