Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.

Create an email client template

Log in to subscribe to topics and get notified when content changes.

Create an email client template

You can create a different template for each table that uses the email client.

Before you begin

Role required: admin

About this task

The email client uses its own email templates to define default values for fields. Use the following sections in the Email Client Template form to build a client template:
  • Content: The message body.
  • Recipients: The email addresses of users receiving the email message. The email addresses are displayed in the To, Cc, and Bcc fields of the message.
  • Sender Configuration: The method used to generate the email sender (From email address) of the message.

Procedure

  1. Navigate to System Policy > Email > Client Templates.
  2. Click New.
  3. Fill in the fields at the top of the Email Client Template form.
    Top section of the Email Client Template form
    Field Description
    Name A unique template name.
    Table The table that the template applies to. Enable the email client for the same table.
    Conditions The conditions that determine when this client template is used. Use the condition builder to identify the target record that must match before this template is applied to the email client.
    Application The type of scoped application.
    Execution Order A number that indicates the order in which template conditions are evaluated.
  4. Fill in the fields in the Content tab.
    Content tab in the Email Client Template form. Used to specify the content in an email client message.
    Field Description
    Subject Enter a description of the email.
    Content Type Select the format of the message body content: HTML or plain text.
    Body HTML

    If you selected HTML for the Content type, enter the content of the message body using the HTML editor toolbar to format the HTML.

    You can call a mail script by using ${mail_script:script name} in the Body HTML field.

    Body text

    If you selected plain text for the Content type, enter any text or mail script that you want to appear in the message body.

    You can insert a mail script in the Body text field by using the following syntax:
    <mail_script> [code] </mail_script>
  5. Fill in the fields in the Recipients tab.
    Content tab in the Email Client Template form. Used to specify the content in an email client message.
    Field Description
    To Enter a comma-separated list of either field names that contain user email addresses or specific email addresses. To reference an email address using a script, create a script include and then call the script include in the To field. Your script must start with the javascript: prefix. The script must return email addresses in a comma-separated string.
    Cc

    Enter a comma-separated list of either field names that contain user email addresses or specific email addresses. To reference an email address using a script, create a script include and then call the script include in the Cc field. Your script must start with the javascript: prefix. The script must return email addresses in a comma-separated string.

    This field cannot have the same addresses as the To field.

    Bcc

    Enter a comma-separated list of either field names that contain user email addresses or specific email addresses. To reference an email address using a script, create a script include and then call the script include in the Bcc field. Your script must start with the javascript: prefix. The script must return email addresses in a comma-separated string.

    This field cannot have the same addresses as the To or Cc fields.

  6. In the Sender Configuration tab, select the From Generation Type to determine how the sender (From address) in the email client message is generated.
    Use this field only if you want a different From address than the one defined in your SMTP email account.
    • None: The From address is not generated in the email client message.
    • SMTP Email Account: Use the From address of the SMTP email account for the instance as the sender.
    • Select From List: Choose from a list of allowable From addresses defined in the Email Client From Address [sys_email_client_from_address] table.
    • Script: Run a GlideRecord query on the Email Client From Address [sys_email_client_from_address] table.
      For example, the following script sets the From address based on the location of the incident caller:
      (function (fromAddressQuery, targetRecord) {
          // targetRecord is incident for this template
          var location = targetRecord.caller_id.country;
      
          if (location == 'us')
              fromAddressQuery.addQuery('email_address', 'servicedesk.us@example.com');
          else if (location == 'japan')
              fromAddressQuery.addQuery('email_address', 'servicedesk.jp@example.com');
          else if (location == 'uk')
              fromAddressQuery.addQuery('email_address', 'servicedesk.uk@example.com');
      
      })(fromAddressQuery, targetRecord);
    • Text: Enter the email From address to be used in the client.
    Note: The From email address does not appear in the email client unless you configure email client to display the From address. For more information on managing the behavior of email client, see Email client configurations.
    Note: If the domain for the From address is not the domain of the SMTP email account server, the owner of the From domain must configure the SPF record for the domain. The owner changes the domain settings to allow the instance to send email as if from that domain. For details on using SPF records, see ServiceNow KB0535456.
  7. Click Submit.
    The template is added to the Email Client Templates [sys_email_client_template] table.
Feedback