Sender (Email subroutine): Difference between revisions
Jump to navigation
Jump to search
m (→Usage notes) |
m (→Usage notes) |
||
(6 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
and they are also included in the | and they are also included in the | ||
e-mail content as the "From" mail header. | e-mail content as the "From" mail header. | ||
==Syntax== | ==Syntax== | ||
{{Template:Email:Sender syntax}} | {{Template:Email:Sender syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th> | <tr><th>email</th> | ||
<td> | <td>An <var>Email</var> object.</td></tr> | ||
</td></tr> | |||
<tr><th>name</th> | <tr><th>name</th> | ||
<td>The e-mail address of the sender. | <td>The e-mail address of the sender.</td></tr> | ||
</td></tr> | |||
<tr><th>nickname</th> | <tr><th>nickname</th> | ||
<td>An optional string that contains a familiar name associated | <td>An optional string that contains a familiar name associated with the mail sender. | ||
with the mail sender. | This nickname appears in the e-mail content as part of the "From:" mail header.</td></tr> | ||
This nickname appears in the e-mail content as part of the | </table> | ||
</td></tr></table> | |||
==Usage notes== | ==Usage notes== | ||
<ul> | <ul> | ||
<li>The sender's e-mail address is not a required header according to protocol, | <li>The sender's e-mail address is not a required header according to protocol, | ||
It is ''not'' an error if you omit the Sender method | It is ''not'' an error if you omit the <var>Sender</var> method | ||
(or, the equivalent, if you include a Sender call that has a null address) | (or, the equivalent, if you include a <var>Sender</var> call that has a null address) | ||
in your request. | in your request. | ||
However, if no Sender value is set, no <code>From:</code> header is included | However, if no <var>Sender</var> value is set, no <code>From:</code> header is included | ||
in the e-mail content unless you explicitly do so using the | in the e-mail content unless you explicitly do so using the | ||
<var>[[AddHeader (Email subroutine)|AddHeader]]</var> method. | <var>[[AddHeader (Email subroutine)|AddHeader]]</var> method. | ||
Line 38: | Line 38: | ||
and a domain name (a string ending with a period (<tt>.</tt>) | and a domain name (a string ending with a period (<tt>.</tt>) | ||
followed by a domain suffix). | followed by a domain suffix). | ||
<p> | |||
'''Note:''' | '''Note:''' | ||
The actual existence of such an address is not validated; merely its form. | The actual existence of such an address is not validated; merely its form. | ||
A null address value is usually acceptable, however. | A null address value is usually acceptable, however. </p> | ||
< | |||
</ul> | |||
==Examples== | |||
For <var>Sender</var> method examples, see [[Email class#Basic e-mail example|"Basic e-mail example"]] and | |||
[[Email class#E-mail with attachment|"E-mail with attachment"]]. | [[Email class#E-mail with attachment|"E-mail with attachment"]]. | ||
==See also== | ==See also== | ||
{{Template:Email:Sender footer}} | {{Template:Email:Sender footer}} |
Latest revision as of 21:56, 14 August 2012
Mail sender email address (Email class)
The Sender arguments you provide are
sent to the SMTP server in a "MAIL FROM" command,
and they are also included in the
e-mail content as the "From" mail header.
Syntax
email:Sender( name, [nickname])
Syntax terms
An Email object. | |
name | The e-mail address of the sender. |
nickname | An optional string that contains a familiar name associated with the mail sender. This nickname appears in the e-mail content as part of the "From:" mail header. |
Usage notes
- The sender's e-mail address is not a required header according to protocol,
It is not an error if you omit the Sender method
(or, the equivalent, if you include a Sender call that has a null address)
in your request.
However, if no Sender value is set, no
From:
header is included in the e-mail content unless you explicitly do so using the AddHeader method. In practice, SMTP servers typically want a validly formed sender e-mail address, and they reject e-mail if an included sender address value does not contain an at sign (@) and a domain name (a string ending with a period (.) followed by a domain suffix).Note: The actual existence of such an address is not validated; merely its form. A null address value is usually acceptable, however.
Examples
For Sender method examples, see "Basic e-mail example" and "E-mail with attachment".