---
sourceDocument: Australia ServiceNow AI Platform Administration
sourceDocumentLink: https://www.servicenow.com/docs/r/platform-administration

 Release :

    - australia

ft:locale :

    - en-US

ft:publication_title :

    - Australia ServiceNow AI Platform Administration

ft:clusterId :

    - platadm

bundleId :

    - platadm

workflow :

    - Platform


---

# Mail script variables

# Mail script variables {#ariaid-title1}

* Release version: Australia
* 
* Updated March 12, 2026
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

Certain variables are available when processing mail_script scripts.
For examples of mail scripts, see [Example scripting for email notifications](https://www.servicenow.com/docs/GQ1RuzjMkPcJnm0wsk7IBA "Examples of scripting for email notifications.").  
{#r_MailScriptAPI__table_psj_g1q_rq__entry__2}

| Variable | Object Description |
|-|-|
| template | Handles printing from the mail script to the email message. `template.print("message"); //outputs message to the email body.` `template.space("number of spaces"); //outputs spaces to the email body.` |
| email_action | GlideRecord object for the email notification (sysevent_email_action). |
| event | GlideRecord object for the event that fired the notification (sysevent). |
| email | EmailOutbound object Available methods: * `addAddress(String type, String address, String displayname):` type can be cc or bcc. * `setFrom(String address):` override the sender address. * `setReplyTo(String address):` override the reply to address. * `setSubject(String subject):` override the subject of the message. * `setBody(String message):` override the body of the message. {#r_MailScriptAPI__ul_b5v_l1q_rq}The email address that is passed by `setFrom` and `setReplyTo` needs to be in a valid form such as helpdesk@sn.com or Display Name \<helpdesk@sn.com\>. If the email address includes a 'Display Name', then that value overrides the instance's display name. For more information, see [GlideEmailOutbound - Scoped](https://www.servicenow.com/docs/access?context=c_GlideEmailOutboundScopedAPI&version=australia&pubname=australia-api-reference&ft:locale=en-US). |
[Table 1. Mail script variables]

{#r_MailScriptAPI__table_psj_g1q_rq}
**Related tasks**   

* [Include mail scripts in email notifications](https://www.servicenow.com/docs/M~APPsYfaqcHJKQdEPAwIQ "Include mail scripts to customize email notifications, which enable you to apply conditional logic and insert dynamic record data in your notifications.")  
**Related reference**   

* [Example scripting for email notifications](https://www.servicenow.com/docs/GQ1RuzjMkPcJnm0wsk7IBA "Examples of scripting for email notifications.")
* [Useful attachment scripts](https://www.servicenow.com/docs/h_CW0hlZ9NdG~7XAuQ2acA "This is a searchable version of the Useful Attachment Scripts.")

