HeaderCollectionAdd Method (String, String, Boolean, Int32) |
Adds a header to the collection at the specified position.
Namespace: MailBee.MimeAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax public bool Add(
string name,
string value,
bool overwrite,
int index
)
Public Function Add (
name As String,
value As String,
overwrite As Boolean,
index As Integer
) As Boolean
Parameters
- name
- Type: SystemString
The name of the header. - value
- Type: SystemString
The value of the header. - overwrite
- 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. - index
- Type: SystemInt32
The zero-based index of the newly added header in the collection.
Return Value
Type:
Booleantrue if the header was successfully added; otherwise,
false.
Examples This sample creates a new message and adds a header at the beginning of the message.
using MailBee;
using MailBee.Mime;
MailMessage msg = new MailMessage();
msg.Headers.Add("MyHeader", "Some value for my own header", false, 0);
Imports MailBee
Imports MailBee.Mime
Dim msg As New MailMessage
msg.Headers.Add("MyHeader", "Some value for my own header", False, 0)
See Also