Description: SMTP client package for sending text email via a local or remote SMTP-compliant mail server.
Syntax:
Tcl: MAIL {argument string}
MAIL $stringvariable
JScript: MAIL("argument string");
MAIL(stringvariable);
VB Script: MAIL "argument string"
MAIL stringvariable
Arguments:
"host=mailserver"
"port=port"
"subject=PUT SUBJECT HERE"
"from=valid email address"
"to=recipient@compay.com"
"to_add=anotherrecipient@company.com"
"cc=anotherrecipient@company.com"
"cc_add=anotherrecipient@company.com"
"bcc= anotherrecipient@company.com "
"bcc_add=recipient@company.com "
"body= Put message here. "
"body_add=Another Line for message. "
"send"
See Also: <MAIL> keymacro, GOTODAQ URL mailto
The MAIL Action Commands (and the equivalent keymacros) provide an easy interface for sending email messages from a Advantech WebAccess/SCADA via a local or remote SMTP-compliant mail server. This package was written to be as portable as possible and is known to work on Windows systems. Email is sent from the Project Node, even if sent by a Web Client.
Special formatting characters are:
\n - starts a new line
\t - tabs the line
\\ - includes a single back slash \ in the message
\{ - includes a single curly bracket { in the message
\} - includes a single curly bracket } in the message
This MAIL package provides only the html and text transport mechanism -- no provisions have been made for attachments or other fancier email features. Text is the default. SMTP is supported. MIME and attachments are not supported. MAIL attempts to be as RFC-compliant as possible.
The MAIL Action commands put a simple interface around mail sending, requiring options for specifying the host (mail server), port, From, TO and SUBJECT. A Body option specifies the body of the message directly. One or more recipient email addresses should be specified using the to, cc, or bcc respective list-oriented options.
Advantech WebAccess/SCADA SCADA nodes and Clients will send an email through an SMTP compatible mail server. By default, this is the Project Node. If the Project node is part of a domain, sending email to other users within the same domain does not usually require any additions. If mail must be sent outside of the mail server's domain, then the Project Node must connect to a computer that is part of the Internet, a so-called "Smart Host". During software installation on the Project Node, the user can specify a Smart Host that is usually the company's email server. By default, the Smart Host is mail.Advantech.com. This is set during software installation.
You can use any Smart Host with the MAIL "host=" command. You can change the default Smart Host from Internet Services Manager. See MAIL "host=" for more information. to the list of IP Addresses that can "relay" mail through the mail server.
An SMTP Server option in Internet Information Server (IIS) must be installed on the Project Node to use the default settings. If SMTP server is not installed on the project node, you will have to use the MAIL "host=yourSMTPserver" before each MAIL send command.
Troubleshooting
There is an error message log on the SCADA node at:
drive:\WebAccess\Node\project_scadanode\bwmail.log
TCL
In Tcl, it is recommended to use the curly brackets {} if possible to avoid interpreter from misunderstanding punctuation. If the contents must be evaluated by Tcl, like $variable or [GETVAL tagname], then double quote marks "" should be used as the delimiter.
Examples: #Tcl
MAIL host=67.94.27.200
MAIL port=25
MAIL {subject=PUT SUBJECT HERE}
MAIL subject=@SUBJECTTAG
MAIL to=recipient@compay.com
MAIL to_add=anotherrecipient@company.com
MAIL cc=anotherrecipient@company.com
MAIL cc_add=anotherrecipient@company.com
MAIL bcc=anotherrecipient@company.com
MAIL "bcc_add=$stringvariable"
MAIL {body= Put message here. }
MAIL "body_add=Another Line for message. "
MAIL {body_add=@ZT-184.ENUNIT}
MAIL "body_add= at [GETVAL %TTMTIME] on [GETVAL %TTMDATE]."
MAIL send
// JScript
MAIL("host=mailserver");
MAIL("port=25");
MAIL("subject=PUT SUBJECT HERE");
MAIL("from=valid email address");
MAIL("to=recipient@compay.com");
MAIL("to_add=anotherrecipient@company.com");
MAIL("cc=anotherrecipient@company.com");
MAIL("cc_add=anotherrecipient@company.com");
MAIL("bcc=anotherrecipient@company.com ");
MAIL("bcc_add=recipient@company.com ");
MAIL("body= Put message here. ");
MAIL("body_add=Another Line for message. ");
MAIL("send");
Rem VB Script
MAIL "host=mailserver"
MAIL "port=25"
MAIL "subject=PUT SUBJECT HERE"
MAIL "from=valid email address"
MAIL "to=recipient@compay.com"
MAIL "to_add=anotherrecipient@company.com"
MAIL "cc=anotherrecipient@company.com"
MAIL "cc_add=anotherrecipient@company.com"
MAIL "bcc=anotherrecipient@company.com "
MAIL "bcc_add=recipient@company.com "
MAIL "body= Put message here. "
MAIL "body_add=Another Line for message. "
MAIL "send"
Script Examples:
#Tcl Sample scr to send email
MAIL host=mail.Advantech.com
MAIL port=25
MAIL from=@FROMWHOTAG
MAIL from=carter@Advantech.com
MAIL subject=@SUBJECTTAG
MAIL to=@TOWHOtag
MAIL cc=tom@Advantech.com
MAIL bcc=infoe@Advantech.com
MAIL {body=Hello from Advantech WebAccess/SCADA! }
MAIL {body_add=\nStart New Line. Then add text. }
MAIL {body_add=Add Text. Then start new line\n}
MAIL {body_add=\tSecond Line starts with a Tab. Start two new lines\n\n}
MAIL {body_add=Add a Slash to start\\stop.\n}
MAIL {body_add=\n}
MAIL {body_add=Add curly brackets for \{info\}\n\n}
MAIL {body_add=@MESSAGE1}
MAIL {body_add=\nThis is the current value of Tag ZT-184:}
MAIL {body_add=@ZT-184 }
MAIL {body_add=@ZT-184.ENUNIT}
MAIL "body_add= at [GETVAL %TTMTIME] on [GETVAL %TTMDATE]."
MAIL {body_add= \n\n}
MAIL {body_add=Regards,\n\n}
MAIL {body_add=\tTom Carter}
MAIL {body_add=\n\tAdvantech Automation Corp.}
MAIL send