Mail (Email function)

From m204wiki
Jump to navigation Jump to search

Send the mail message (Email class)

This callable method sends the mail message to an SMTP server.


[%rc =] email:Mail[( [[Port=] string], [[CancelOnError=] number], - [Userid= string], [Password= string])]

Syntax terms

%rc A numeric variable to contain the return code.

A value of 0 indicates success; a value of 1 indicates a communication error. If some other unexpected content is present or event occurs, %rc will contain the return code sent from the SMTP server. These codes are listed in "SMTP server codes".

email An Email object.
Port An optional string expression that identifies a previously defined Janus CLSOCK port.

The default is the MASTER port, if any is defined. However, if you omit this argument and no MASTER port is defined, the request is cancelled (subject to the CancelOnError setting).

CancelOnError An optional numeric expression that controls whether the request is cancelled if a communication/socket error occurs:
  • If zero, the request is not cancelled on these errors.
  • If non-zero, the request is cancelled (though a message is still issued).
  • If not specified, the default is to cancel the request.

Usage notes

  • The Email class adds a "Date:" header to an Email object instance by default if you do not explicitly add one with AddHeader. If a Date header is present at the time the mail method is invoked, it is left intact. The Date header generated by the Email class uses the system clock (usually GMT), adjusted by the GMT offset specified in the OS system parameters.
  • For Mail method examples, see "Basic e-mail example" and "E-mail with attachment".

See also