{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":40207,"path":"platform-administration/use-mail-scripts-email-notifications.md","title":"Include mail scripts in email notifications","bundle":null,"doc_type":null,"release":"australia","body":"\n# Include mail scripts in email notifications\n\nInclude mail scripts to customize email notifications, which enable you to apply conditional logic and insert dynamic record data in your notifications.\n\n## Before you begin\n\nRole required: admin\n\n## About this task\n\nFor more information about using scripts with email notifications, see [Scripting for email notifications](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-administration/c_ScriptingForEmailNotifications.md) and [Notification Email Scripts](https://developer.servicenow.com/dev.do#!/learn/learning-plans/australia/servicenow_administrator/app_store_learnv2_automatingapps_australia_notification_email_scripts) on the developer site.\n\n## Procedure\n\n1.  Navigate to **All** &gt; **System Notification** &gt; **Email** &gt; **Notifications**.\n\n2.  Select and open the email notification where you want to include the mail script.\n\n3.  In the **Message HTML** field on the **What it will contain** tab, either embed an existing mail script or enter a mail script manually.\n\n    -   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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-security/t_ConfigureHTMLSanitizer.md).\n    -   To enter a mail script manually, add the script and enclose it within the `<mail_script>` and `</mail_script>` tags.\n4.  On the form header, right-click and select **Save**.\n\n5.  If you manually added a mail script in the **Message HTML** field, select **Yes** in the configuration dialog box that appears.\n\n    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}`.\n\n\n## Mail scripts embedded in an email notification\n\n\\[Omitted image \"example-mail-script-notification.png\"\\] Alt text: Message HTML field displaying mail script tags in an email notification\n\n**Parent Topic:**[Scripting for email notifications](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-administration/c_ScriptingForEmailNotifications.md)\n\n**Related topics**  \n\n\n[Mail script variables]()\n\n[Example scripting for email notifications]()\n\n[Useful attachment scripts]()\n\n"}}