MailBee.NET Objects 4.0

HeaderCollection.Add Method 

Adds a header to the collection.

public bool Add(
   string name,
   string value,
   bool overwrite
);

Parameters

name
The name of the header.
value
The value of the header.
overwrite
If true all found headers having the specified name are removed, while only one header will be inserted instead of them; otherwise, another header having the same name will be added.

Return Value

true if the header was successfully added; otherwise, false.

Example

This sample creates a new message and adds a header to this message.

[C#]
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.Mime;

// Create a MailMessage object.
MailMessage msg = new MailMessage();

// Add a header.
msg.Headers.Add("MyHeader", "Some value for my own header", false);
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.Mime

' Create a MailMessage object.
Dim msg As New MailMessage

' Add a header.
msg.Headers.Add("MyHeader", "Some value for my own header", False)

See Also

HeaderCollection Class | MailBee.Mime Namespace | Header