<< back to sysax.com Product page

11.3. Sending email

The mailsend command is used to send an email message that has been created using the mailcreate command. The same email message can be sent to multiple recipients by calling this command multiple times with the email address of each recepient. The internet address of the mail server and the corresponding port number must be specified in addition to the recipient's name and email address. In most cases, these values can be obtained from your default email program. The mailresult predefined status flag is set to the predefined constant success if the command completed successfully.

An optional username and password may also be supplied if the mail server requires it. Many mail servers now implicitly require users to authenticate before sending mail. In these cases, the username and password used to read email from this server should be supplied.

Exhibit 11.7. Syntax of command for sending email

mailsend <mail server address>, <server port>, <recipient name>, <recipient email> [, optional: <username>, <password>];

Exhibit 11.8. Examples for using the command for sending email

mailsend "mail.jdinc.com", 25, "Jim Jones", "jj@jj.com", "username", "pass"; #send email message

mailsend "mail.jdinc.com", 25, "Joe Smith", "js@js.com", "username", "pass"; #send same message to another recipient

In addition, the mailsendssl command can be used to send an email message if the mail server accepts only ssl encrypted connections.

Exhibit 11.9. Syntax of command for sending email for ssl

mailsendssl <mail server address>, <server port>, <recipient name>, <recipient email> [, optional: <username>, <password>];

Exhibit 11.10. Examples for using the command for sending email for ssl

mailsendssl "mail.jdinc.com", 25, "Jim Jones", "jj@jj.com", "username", "pass"; #send email message

mailsendssl "mail.jdinc.com", 25, "Joe Smith", "js@js.com", "username", "pass"; #send same message to another recipient

And the mailsendtls command can be used to send an email message if the mail server requires the use of STARTTLS to initiate secure SSL/TLS encrypted connections.

Exhibit 11.11. Syntax of command for sending email for tls

mailsendtls <mail server address>, <server port>, <recipient name>, <recipient email> [, optional: <username>, <password>];

Exhibit 11.12. Examples for using the command for sending email for ssl

mailsendtls "mail.jdinc.com", 25, "Jim Jones", "jj@jj.com", "username", "pass"; #send email message

mailsendtls "mail.jdinc.com", 25, "Joe Smith", "js@js.com", "username", "pass"; #send same message to another recipient