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.5.0 build 687 for .NET 4.5
Syntax
public string this[
	string name
] { get; set; }

Parameters

name
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.
Remarks
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.
Examples
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();
msg.LoadMessage(@"C:\Docs\TestMail.eml");

// 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