Send notification mail from scripts

Automatically send custom e-mail messages from scripts

In addition to the ScriptRunner E-mail Notification Connector you can send e-mails from scripts, with the function SRSendMail from the library script Send-SRMail. The script is part of the ScriptRunner ExtensionPack (via GitHub).

  • Define the Script in the Action Wizard.
    Select the action and click the EDIT button in the Action Bar (below). Then select the Wizard page PowerShell Options. After activating Library script to preload..., the library script can be selected. The library script will be listed in the drop-down list, if it is stored in a script repository folder named _LIB_ or marked with the _LIB_ tag.
  • These parameters are required and must be set when calling the function
    • MailSender
      Specifies the address from which the e-mail is sent
    • MailRecipients
      Specifies the e-mail addresses to which the e-mail is sent.
      Use the comma to separate the addresses
    • MailSubject
      Specifies the subject of the e-mail message
  • Optionally these parameters can be set:
    • MailBody
      Specifies the body text of the e-mail message
    • MailServer
      Specifies the name of the SMTP server that sends the e-mail message.
      The default value is the value of the $PSEmailServer preference variable
    • MailServerCredential
      Specifies a user account that has permission to perform this action.
      By default, it is the executing user of the script
    • Attachments
      Specifies the path and file names of files to be attached to the e-mail message.
      Use the comma to separate the files
    • CopyRecipients
      Specifies the e-mail addresses to which a carbon copy (CC) of the e-mail message is sent. Use the comma to separate the addresses
    • MailPriority
      Specifies the priority of the e-mail message, default is normal
    • MailBodyEncoding
      Specifies the type of encoding for the body text, default is UTF-8
    • MailUseSsl
      Uses the Secure Sockets Layer (SSL) protocol to establish a connection to the remote computer to send e-mail
    • HtmlBody
      Specifies that the value of the body text contains HTML, default is true 

    The script can be found here: ScriptRunner Send Mail Script

    This page has been automatically translated and may contain grammatical errors or inaccuracies