Include mail scripts in email notifications

  • Release version: Australia
  • Updated May 4, 2026
  • 1 minute to read
  • Include mail scripts to customize email notifications, which enable you to apply conditional logic and insert dynamic record data in your notifications.

    Before you begin

    Role required: admin

    About this task

    For more information about using scripts with email notifications, see Scripting for email notifications and Notification Email Scripts on the developer site.

    Procedure

    1. Navigate to All > System Notification > Email > Notifications.
    2. Select and open the email notification where you want to include the mail script.
    3. In the Message HTML field on the What it will contain tab, either embed an existing mail script or enter a mail script manually.
      • To embed an existing mail script if you do not have HTML sanitizer configured, add ${mail_script:script_name}. If you have HTML sanitizer configured, add ${{mail_script:script_name}} to apply HTML sanitization and help avoid security concerns in your HTML content. For more information, see Configuring HTML sanitizer.
      • To enter a mail script manually, add the script and enclose it within the <mail_script> and </mail_script> tags.
    4. On the form header, right-click and select Save.
    5. If you manually added a mail script in the Message HTML field, select Yes in the configuration dialog box that appears.
      The script is added to the Email Script [sys_script_email] table and replaced in the Message HTML field with an embedded script tag: ${mail_script:script_name}.

    Mail scripts embedded in an email notification

    Message HTML field displaying mail script tags in an email notification