12.4.22    MAIL

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 WebAccess 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.

WebAccess SCADA nodes and Clients will send an email through an SMTP compatible mail server.  By default, WebAccess will send mail from the Outgoing SMTP Server configured in SCADA Node Properties. 

You can use any other SMTP server with the MAIL "host=" command.   See MAIL "host=" for more information. 

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 Example: #Tcl

 

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.com");

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.com"

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.yourcompany.com

MAIL port=25

MAIL from=@FROMWHOTAG

MAIL from=carter@yourcompany.com

MAIL subject=@SUBJECTTAG

MAIL to=@TOWHOtag

MAIL cc=tom@yourcompany.com

MAIL bcc=infoe@yourcompany.com

MAIL {body=Hello from WebAccess! }

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 send