MailMill .NET Class Library

MailHeaders.Add Method (String, Object)

Adds an header field at the end of the MailHeaders object.

public int Add(
   string key,
   object value
);

Parameters

key
The header field name.
value
The header field value.

Return Value

The MailHeaders index at which the value has been added.

Exceptions

Exception Type Condition
ArgumentNullException key is a null reference (Nothing is Visual Basic).
ArgumentException key is an empty string
-or-
The header value is invalid.

Example

This sample shows how to add and header field to a Mail object.

Mail oMail = new Mail();
oMail.Headers.Add("X-Private-Field", GetPrivateFieldString());

See Also

MailHeaders Class | MailMill Namespace | MailHeaders.Add Overload List | Mail | Mail.Headers