Content Headers Collection

The Content.Headers collection contains all message part headers. The collection can be used to determine the value of a specific header item, or to iterate through the collection and retrieve a list of all items in the message part header. See the Collection Object for standard collection properties and methods.

Syntax

Content.Headers(key|index)[(subkey)]

Parameters
key
The identifier for the item to return.
index
An index offset indicating which item in the list to return. The index starts at 0
subkey
The identifier for the sub item to return. An empty string will return the primary item.
Remarks

The key should not contain the column character ':'
eMill implements the following internal header fields (these fields will never appear in the MIME encoded mail) :
X-Enabled: Set to 1 if the content should be included in the final rendered message, set to 0 otherwise.
X-Body: Set to 1 if the content is the body part of the message. This property only applies to text/plain and text/html contents. A body part is the part that is first displayed when a message is opened.
X-PDF: Set to 1 if the content should be converted to the Acrobat PDF format. Only text/plain and text/html contents can be converted to PDF.
X-ZIP: Set to 1 if the content should be converted to the ZIP format. 
X-Render: Set to 1 if the source contains script to be executed. The script should be within <% and %> delimiters.
X-Wrap-Text: Set to n (76 is the recommended value) to limit the number of characters per line in a text/plain content.
X-Href-Prefix: Specify a prefix to set on all http:// urls in a text/html content. Can be used to implement a URL tracking system.
X-Href-Suffix: Specify a suffix to set on all http:// urls in a text/html content. Can be used to implement a URL tracking system.
X-Embed-Images: Set to 1 if the images referenced in the HTML content should be embedded within the message, set to 0 otherwise.
X-Tracking: Set to 3 to enable openings and clicks tracking, set to 2 to enable clicks tracking, set to 1 to enable openings tracking or set to 0 to disable tracking for this content.
X-Disable-Merge-Fields: Set to 1 to disable merge fields replacement for text contents.

The X-PDF and X-ZIP header fields support a "filename" subkey that can be used to specify the resulting file name. The X-ZIP field support a "password" subkey that can be used to password protect the resulting zip file.

Example

In the following example, a customized Content-Disposition header field is set on the Mail_OnStartRender event

Sub Mail_OnStartRender
    With Mail.Contents("Invoice")
        .Headers("Content-Disposition") = "attachment"
        .Headers("X-PDF") = "1" ' The html invoice will be converted to PDF (Content-Type: application/pdf)
       
.Headers("X-PDF")("filename") = "Invoice.pdf" ' Optional attribute to specify the PDF filename 
    End With
End Sub

In the following example, we read the charset from the content type using a  subkey

If the "Content-Type" contains: "text/html; charset=iso-8859-1"
Mail.Contents("NewsLetter").Headers("Content-Type")("charset") ' Returns iso-8859-1
Mail.Contents("NewsLetter").Headers("Content-Type")("") ' Returns text/html
Mail.Contents("NewsLetter").Headers("Content-Type") ' Returns text/html; charset=iso-8859-1

Applies To

Content Object


©2001-2015 eMill. All trademarks property of their owners.