MailMill .NET Class Library

MailHeaders.Add Method (Object)

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

public override int Add(
   object value
);

Parameters

value
a DictionaryEntry containing the header field name and value.

Return Value

The MailHeaders index at which the value has been added.

Implements

IList.Add

Remarks

value must be of type DictionaryEntry and value.Key must be of type string otherwise an error occurs.

Exceptions

Exception Type Condition
ArgumentNullException value is a null reference (Nothing is Visual Basic).
ArgumentException value is not of type DictionaryEntry
-or-
value is not a valid header field.

Example

This sample shows how to add a DictionaryEntry containing an header field to a Mail object.

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

See Also

MailHeaders Class | MailMill Namespace | MailHeaders.Add Overload List | System.String | System.Collections.DictionaryEntry | Mail | Mail.Headers