Alertra Script Language 1.9

smtp

Interacts with an SMTP server to perform the following functions: connect, verify and sendmail.

You can force the connection to use TLS mode by setting the local variable smtptls to "Y", e.g.:

set smtptls="Y"

If the server doesn't doesn't support TLS, the connection will fail.

usage: smtp [sendmail [from] [to] [subject] [msg]] [verify [address]] [user] [password]

parameters:

req name type description
Y operation keyword One of:
  • connect: Connects to the SMTP server and looks for the proper greeting.
  • sendmail: Sends an email using the SMTP server to the given toAddress.
  • verify: Asks the SMTP server to verify that the given toAddress is valid on that server.
N from expression When performing a 'sendmail' operation, this is the e-mail address that should be sent in the SMTP "From:" header. This field is only required for the 'sendmail' operation.
N to expression When performing a 'sendmail' operation, this is the e-mail address that should receive the message. This field is only required for the 'sendmail' operation.
N subject expression The subject to send with the message when performing a 'sendmail' operation. This field is only required for the 'sendmail' operation.
N msg expression The text of the message to send when sending a message to the SMTP server using the 'sendmail' operation. This field is only required for the 'sendmail' operation.
N address expression The e-mail address that should be checked with the SMTP server when using the 'verify" operation. This field is only required for the 'verify' operation.
N user expression Login ID for a valid user of the SMTP server; this field is not widely used by most SMTP servers.
N password expression Password for login ID; this field is required if user is specified.

examples

smtp sendmail "joe@alertra.com" "holly@alertra.com" "Test Message" "This is a test message"

This example will send a message to holly@alertra.com from joe@alertra.com with the subject Test Message and contents of This is a test message.

smtp sendmail $FROM_ADDR "julie@alertra.com" "Test Message" $MSG_TEXT "joe" "passpass"

Send a message to julie@alertra.com from the address defined in the variable FROM_ADDRESS with the subject Test Message, the contents of MSG_TEXT as the text of the message and logging in as joe with the password passpass.

smtp verify "tom@alertra.com"

Connects to the SMTP server and verifies the address tom@alertra.com is valid.


Alertra Script Language: Language Reference