Contents Collection

The Contents collection contains all content files. The collection can be used to determine the value of a specific content item, or to iterate through the collection and retrieve a list of all items in the message.

Syntax

Content = Object.Contents(key|index)

Parameters
key
The name of the content to retrieve.
index
An index offset indicating which item in the list to return. The index starts at 0
Return Value

Returns a Content Object

Examples

In the following example, a specific content is removed on the Mail_OnStartRender event

Sub Mail_OnStartRender
    If Record.Fields("Details") = False Then
        Mail.Contents.Remove("Details")
    End If
End Sub

In the following example, a content is added on the Mail_OnStartRender event

Sub Mail_OnStartRender
   Set oContent = Mail.Contents.Add "My new content" 'Add a content named "My new content"
   oContent.Data = "Hello this is a test message" 'Add the text data inside of it
   oContent.Type = "text/plain" 'Set the content-type
   oContent.Headers("X-Body") = 1 'Specify that the content is part of the body
End Sub

Applies To

Mail Object, Mailing Object

See Also

Content Object



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