SendMail <to>, <subject>, <text>[, <from>]
This command sends a fixed text or text from a file to a given mail address via email. If the text parameter starts with an at-sign character, the rest is a filename from which the text will be loaded. The filename can be $(logfile) which refers to the PyroBatch logfile to which the program progress is written.
The SendMail command will normally try to determine the mail server on it's own, but if necessary you can specify a mail server after the to- address separated by a colon (see example below). If your smtp server requires authentication, you can provide username and password together with the server name, each separated by vertical bars (also see the example below).
Example: SendMail "admin@nowhere.com", "PyroBatch Error", "PyroBatch Failed!"
Example: SendMail "admin@nowhere.com:smtp.nowhere.com", "PyroBatch Error", "PyroBatch Failed!"
(send msg to admin@nowhere.com via mailserver smtp.nowhere.com)
Example: SendMail "pyroboss@nowhere.com:joedoe|xyz123|smtp.nowhere.com", "PyroBatch Error", "PyroBatch Failed!"
(send msg to pyroboss@nowhere.com via mailserver smtp.nowhere.com and authenticate as smtp user joedoe with password xyz123)
Example: SendMail "techdude@nowhere.com", "PyroBatch Error", "Please check the logs!", "pyro@myserver.com"
(send mail with given text to techdude@nowhere.com from pyro@myserver.com)
Example: SendMail "weberrors@nowhere.com", "PyroBatch Error", "@errormail.txt"
(send contents of the file errormail.txt to weberrors@nowhere.com)
Example: SendMail "admin@nowhere.com", "PyroBatch Error", "@$(logfile)"
(send current logfile to admin@nowhere.com)
As an alternate method to provide the mail server and/or user credentials,
you can use the SetParm command to specify the host, username, password
and optionally a domain for the HELO/EHLO command on the mail server:
SetParm "sendmail.smtphost", "smtp.gmail.com"
SetParm "sendmail.smtpuser", "username@gmail.com"
SetParm "sendmail.smtppass", "Pass.Word#123"
SetParm "sendmail.smtphelo", "localhost"
SetParm "sendmail.do_ssl", "yes"
SendMail "username@mail.com", "Report", "This is a mail from PyroBatch!"
← Back to Script Commands