Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

Mail script variables

Certain variables are available when processing mail_script scripts.

For examples of mail scripts, see Example scripting for email notifications.

VariableObject Description
templateHandles 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\_actionGlideRecord object for the email notification \(sysevent\_email\_action\).
eventGlideRecord object for the event that fired the notification \(sysevent\).
emailEmailOutbound 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. 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 `. If the email address includes a 'Display Name', then that value overrides the instance's display name. For more information, see GlideEmailOutbound - Scoped.

Parent Topic:Scripting for email notifications

Related topics

Include mail scripts in email notifications

Example scripting for email notifications

Useful attachment scripts

sndocs is an independent community mirror and is not affiliated with or endorsed by ServiceNow.

ServiceNow, the ServiceNow logo, Now, and other ServiceNow marks are trademarks and/or registered trademarks of ServiceNow, Inc., in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with which they are associated.

© 2026 ServiceNow, Inc. All rights reserved.

Documentation content is redistributed under the Apache License 2.0 from the ServiceNowDocs repository.