Encapsulates the AutoMate™ action in the “Email” group, “Send Message.” The method attempts to send an email message through the specified SMTP server.
Declaration
function SendEmail (varServer As Variant,
varUsername As Variant,
varTo As Variant,
varCC As Variant,
varSubject As Variant,
varBodyFilename As Variant,
varAttachmentFilename As Variant) As Integer
Parameters
varServer
The hostname or IP address of the SMTP server to use to send the email message.
varUsername
The username of the user with forwarding privileges on the SMTP server.
varTo
The email address (e.g. cowpoke@cowboy.com) of the primary recipient for the email message.
varCC
The email address or addresses of CC recipients of the message. Multiple email addresses can be supplied by separating each one with a semi-colon (e.g. ranchmaster@cowboy.com;masterchef@ranchhouse.com)
varSubject
The subject of the email message. This will appear in the Subj section of the sent message. This can be blank.
varBodyFilename
The full path and filename of the file which contains the contents of the message to be sent.
varAttachmentFilename
The full path to the binary attachment to send with the message. AutoMate™ currently supports only one attachment.
Description
The SendEmail method attempts to send the contents of text file varBodyFilename as an email message using the SMTP server supplied by varServer.
To send a message, first create a text file using your favorite text editor. Inside the text file, type out the message body of the email message. The body can contain AutoMate™ variables and constants; the body will be parsed and processed by AutoMate™ before it is sent. Save the file and make note of its location.
Next, use the SendEMail method, supplying the primary recipient in the varTo address, and any carbon-copy recipients in the varCC parameter, separating their address with a semi-colon. Optionally, you can supply a subject heading for the message using the varSubject parameter. Use the path to the text file you previously created with the message contents in varBodyFilename, and a path to any attachment you wish to send in varAttachmentFilename.
The method returns “0” if the message was submitted to the SMTP server properly; otherwise it returns “1.” Note that the function succeeds if the message is successfully submitted, not whether or not the message necessarily received by the recipient(s).