AddHeader (Email subroutine): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (Created page with "This callable method lets you add an SMTP request header to the SMTP request that is sent to the server. ==AddHeader syntax== <p class="pre"> %email:AddHeader(header, value) </p>...")
 
m (Created page with "This callable method lets you add an SMTP request header to the SMTP request that is sent to the server. ==AddHeader syntax== <p class="pre"> %email:AddHeader(header, value) </p>...")
Line 1: Line 1:
{{Template:Email:AddHeader subtitle}}
This callable method lets you add an SMTP request header
This callable method lets you add an SMTP request header
to the SMTP request that is sent to the server.
to the SMTP request that is sent to the server.
==AddHeader syntax==
==Syntax==
<p class="pre"> %email:AddHeader(header, value)
{{Template:Email:AddHeader syntax}}
</p>
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
Line 12: Line 12:
<tr><th>header</th>
<tr><th>header</th>
<td>A string expression that names an SMTP request
<td>A string expression that names an SMTP request
header, such as &ldquo;Reply-To&rdquo; or &ldquo;In-Reply-To.&rdquo;
header, such as &amp;ldquo;Reply-To&amp;rdquo; or &amp;ldquo;In-Reply-To.&amp;rdquo;
Header names are case insensitive.
Header names are case insensitive.
   
   
Line 24: Line 24:
   
   
</td></tr></table>
</td></tr></table>
==Usage Notes==
==Usage notes==
<ul>
<ul>
<li>Do ''not'' set &ldquo;To:&rdquo; or &ldquo;Cc:&rdquo; headers using this method.
<li>Do ''not'' set &amp;ldquo;To:&amp;rdquo; or &amp;ldquo;Cc:&amp;rdquo; headers using this method.
These headers
These headers
require special handling and are set using the AddRecipient and AddCc
require special handling and are set using the AddRecipient and AddCc
Line 34: Line 34:
These headers require special handling and are set using parameters on
These headers require special handling and are set using parameters on
the SetBody and AddPart methods.
the SetBody and AddPart methods.
Specifying a header that has a &ldquo;Content-&rdquo; prefix causes a request cancellation.
Specifying a header that has a &amp;ldquo;Content-&amp;rdquo; prefix causes a request cancellation.
<li>The SMTP Helper adds a &ldquo;Date:&rdquo; header to an Email object instance by default
<li>The SMTP Helper adds a &amp;ldquo;Date:&amp;rdquo; header to an Email object instance by default
if you do not explicitly add one with AddHeader.
if you do not explicitly add one with AddHeader.
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,
Line 43: Line 43:
<li>For an example that includes this method, see [[SMTP Helper#Basic e-mail|"Basic e-mail"]].
<li>For an example that includes this method, see [[SMTP Helper#Basic e-mail|"Basic e-mail"]].
</ul>
</ul>
==See also==
{{Template:Email:AddHeader footer}}

Revision as of 21:41, 5 July 2011

Add an SMTP request header (Email class)


This callable method lets you add an SMTP request header to the SMTP request that is sent to the server.

Syntax

email:AddHeader( header, value)

Syntax terms

%email A previously declared Email object.
header A string expression that names an SMTP request

header, such as &ldquo;Reply-To&rdquo; or &ldquo;In-Reply-To.&rdquo; Header names are case insensitive.

Passing multiple occurrences is allowed: if a like-named header is already present, an additional occurrence is added.

value A string expression that yields a value for the

request header.

Usage notes

  • Do not set &ldquo;To:&rdquo; or &ldquo;Cc:&rdquo; headers using this method. These headers require special handling and are set using the AddRecipient and AddCc methods, respectively. The Mail method will not recognize recipients added with AddHeader.
  • Do not set Content-Type headers using this method. These headers require special handling and are set using parameters on the SetBody and AddPart methods. Specifying a header that has a &ldquo;Content-&rdquo; prefix causes a request cancellation.
  • The SMTP Helper adds a &ldquo;Date:&rdquo; 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 SMTP Helper uses the system clock (usually GMT), adjusted by the GMT offset specified in the OS system parameters.
  • For an example that includes this method, see "Basic e-mail".

See also