Header Class |
Namespace: MailBee.Mime
The Header type exposes the following members.
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
Name |
Gets or sets the name of the message header as a string.
| |
Value |
Gets or sets the value of the message header as a string.
|
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:
Name | Value |
---|---|
From | John Doe <jdoe@hisdomain.com> (XXX Company) |
To | Katy Smith <k.smith@herdomain.com> |
Cc | techsupport@ourdomain.com |
Subject | Meeting request. |
Content-Type | multipart/mixed; boundary="--511842ECA261D" |
Date | Thu, 8 Dec 2005 19:27:22 -0500 |
X-Priority | 3 (Normal) |
// 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)); }