Click or drag to resize

MailMergeMergeT Method (MailMessage, IEnumerableT)

Generates a collection of mail messages based on the specified template and populated with provided data.

Namespace:  GemBox.Email
Assembly:  GemBox.Email (in GemBox.Email.dll) Version: 13.0.35.1008
Syntax
public static ReadOnlyCollection<MailMessage> Merge<T>(
	MailMessage template,
	IEnumerable<T> items
)

Parameters

template
Type: GemBox.EmailMailMessage
The template mail message.
items
Type: System.Collections.GenericIEnumerableT
The generic list of objects used as data source.

Type Parameters

T
The type of data elements in the collection.

Return Value

Type: ReadOnlyCollectionMailMessage
A read-only collection of mail messages based on the specified template and populated with provided data.
Exceptions
ExceptionCondition
ArgumentNullException Template is null or Data source is null
Remarks
Method returns a collection of messages based on the specified template. Strings starting and ending with delimiter (%) are replaced with values from provided data source. These variables can be used in: Subject, BodyText and BodyHtml properties.

Note Note
Data source must contain value named 'To' which represents receiver mail address. Other predefined value names are: 'Cc', 'Bcc' and 'ReplyTo'.

See Also