Click or drag to resize

MailMergeMerge Method (MailMessage, DataTable)

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: 11.3.30.1034
Syntax
public static ReadOnlyCollection<MailMessage> Merge(
	MailMessage template,
	DataTable data
)

Parameters

template
Type: GemBox.EmailMailMessage
The template mail message.
data
Type: System.DataDataTable
The data source.

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