Header Class
Provides properties for examining or setting the name or the value of a single field of the headers section of a MIME part.
Inheritance Hierarchy
SystemObject
  MailBee.MimeHeader

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax
public class Header

The Header type exposes the following members.

Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Properties
  NameDescription
Public propertyCode exampleName
Gets or sets the name of the message header as a string.
Public propertyCode exampleValue
Gets or sets the value of the message header as a string.
Top
Remarks

Each MIME part of the message (including the message itself which is actually a root MIME part) have header section containing of some name-value pairs. Header class represents such a pair. To access the entire collection of MIME part headers, use MimePart.Headers property. To access headers of the message itself, it's easier to use MailMessage.Headers property.

Some examples of header names and values are represented below:

NameValue
FromJohn Doe <jdoe@hisdomain.com> (XXX Company)
ToKaty Smith <k.smith@herdomain.com>
Cctechsupport@ourdomain.com
SubjectMeeting request.
Content-Typemultipart/mixed; boundary="--511842ECA261D"
DateThu, 8 Dec 2005 19:27:22 -0500
X-Priority3 (Normal)

Examples
This sample loads the message from .EML file and shows all the message headers.
// 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");

// For every header...
foreach (Header hdr in msg.Headers)
{
    // Show the header.
    Console.WriteLine(string.Format("Name: {0}; Value: {1}", hdr.Name, hdr.Value));
}
See Also