Mail (Email function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
 
(13 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==Mail (Email function)==
{{Template:Email:Mail subtitle}}
This callable method sends the mail message to an SMTP server.
 
This [[Notation conventions for methods#Callable functions|callable]] method sends the mail message to an SMTP server.
==Syntax==
==Syntax==
{{Template:Email:Mail syntax}}
{{Template:Email:Mail syntax}}
Line 6: Line 7:
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%rc</th>
<tr><th>%rc</th>
<td>If specified, a numeric variable to contain the return code.
<td>A numeric variable to contain the return code.
   
   
A value of 0 indicates success; a value of 1 indicates a communication error.
A value of 0 indicates success; a value of 1 indicates a communication error.
If some other unexpected content is present or event occurs,
If some other unexpected content is present or event occurs,
''%rc'' will contain the return code sent from the SMTP server.
<var class="term">%rc</var> will contain the return code sent from the SMTP server.
These codes are listed in [[SMTP server codes|"SMTP server codes"]].
These codes are listed in [[GetReplyCode (Email function)#commerr|"SMTP server codes"]].
</td></tr>
</td></tr>
<tr><th>%email</th>
 
<td>A previously declared Email object.
<tr><th>email</th>
<td>An <var>Email</var> object.
</td></tr>
</td></tr>
<tr><th>clientport</th>
<tr><th><var>Port</var></th>
<td>An optional string expression that identifies a previously
<td>An optional string expression that identifies a previously defined Janus <var>[[JANUS DEFINE#type|CLSOCK]]</var> port.
defined Janus CLSOCK port.
The default is the <var>[[MASTER]]</var> port, if any is defined.
The ''clientport'' default is the
However, if you omit this argument and no <var>MASTER</var> port is defined, the request is cancelled (subject to the <var>CancelOnError</var> setting).
[[MASTER]] port, if any is defined.
However, if you omit ''clientport'' and no MASTER port is defined,
the request is cancelled (subject to the ''cancel'' setting).
</td></tr>
</td></tr>
<tr><th>cancel</th>
<tr><th><var>CancelOnError</var></th>
<td>An optional numeric expression that controls whether the request is
<td>An optional numeric expression that controls whether the request is cancelled if a communication/socket error occurs:
cancelled if a communication/socket error occurs:
<ul>
<ul>
<li>If zero, the request is ''not'' cancelled on these errors.
<li>If zero, the request is ''not'' cancelled on these errors.
Line 34: Line 32:
</ul>
</ul>
</td></tr></table>
</td></tr></table>
 
==Usage notes==
==Usage notes==
<ul>
<ul>
<li>The SMTP Helper adds a &amp;ldquo;Date:&amp;rdquo; header to an Email object instance by default
<li>The <var>Email</var> class adds a "Date:" header to an <var>Email</var> object instance by default
if you do not explicitly add one with AddHeader.
if you do not explicitly add one with <var>AddHeader</var>.
If a Date header is present at the time the mail method is invoked,
If a Date header is present at the time the mail method is invoked,
it is left intact.
it is left intact.
The Date header generated by the SMTP Helper uses the system clock (usually GMT),
The Date header generated by the <var>Email</var> class uses the system clock (usually GMT),
adjusted by the GMT offset specified in the OS system parameters.
adjusted by the GMT offset specified in the OS system parameters.
<li>For <var>Mail</var> method examples, see [[SMTP Helper#Basic e-mail|"Basic e-mail"]] and
<li>For <var>Mail</var> method examples, see [[Email class#Basic e-mail example|"Basic e-mail example"]] and
[[SMTP Helper#E-mail with attachment|"E-mail with attachment"]].
[[Email class#E-mail with attachment|"E-mail with attachment"]].
</ul>
</ul>
==See also==
==See also==
{{Template:Email:Mail footer}}
{{Template:Email:Mail footer}}

Latest revision as of 17:08, 29 July 2013

Send the mail message (Email class)


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

Syntax

[%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