HeaderCollectionAdd Method (String, String, Boolean, Int32)
Adds a header to the collection at the specified position.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.2.0 build 630 for .NET 4.5
public bool Add(
	string name,
	string value,
	bool overwrite,
	int index


Type: SystemString
The name of the header.
Type: SystemString
The value of the header.
Type: SystemBoolean
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.
Type: SystemInt32
The zero-based index of the newly added header in the collection.

Return Value

Type: Boolean
true if the header was successfully added; otherwise, false.
This sample creates a new message and adds a header at the beginning of the message.
// 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, 0);
See Also