MailBee.NET Objects 4.0

HeaderCollection.RemoveCustomHeaders Method 

Removes any custom headers from the collection of the message headers.

public void RemoveCustomHeaders();

Remarks

Removes the Header objects with non-standard names from the collection of the message headers. The following headers are standard (and thus will not be removed by this method):

Example

This sample loads the message from .EML file and removes the custom headers from this message.

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

// The actual code (put it into a method of your class)

// Load the message from file.
MailMessage msg = new MailMessage();
msg.LoadMessage(@"C:\Docs\TestMail.eml");

// Remove all non-standard headers from the collection.
msg.Headers.RemoveCustomHeaders();
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.Mime

' The actual code (put it into a method of your class)

' Load the message from file.
Dim msg As New MailMessage
msg.LoadMessage("C:\Docs\TestMail.eml")

' Remove all non-standard headers from the collection.
msg.Headers.RemoveCustomHeaders()

See Also

HeaderCollection Class | MailBee.Mime Namespace | MailMessage | Header