HeaderCollectionItem Property (String)
Gets or sets the header value by the header name.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.2.0 build 630 for .NET 4.5
public string this[
	string name
] { get; set; }


Type: SystemString
The name of the header. Some examples: To, Content-Type, X-UIDL.

Property Value

Type: String
The string representing the value of the header with the specified name, or a null reference (Nothing in Visual Basic) if no such header exists in the collection.
If the collection contains several headers with the specified name, the first matching header will be returned. To access multiple headers with the same name, the developer should use Items(String) method.
This sample loads the message from .EML file and displays the value of Subject: header of the message.
// 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();

// Get the header value by its name.
string subjectHeaderValue = msg.Headers["Subject"];

// If this header exists...
if (subjectHeaderValue != null)
    // Show the header of the message.
    Console.WriteLine("Message subject: " + subjectHeaderValue);
See Also