HeaderItem Class


Provides properties and methods for presenting an e-mail header.

System.Object
    EAGetMail.HeaderItem

[Visual Basic]
Public Class HeaderItem
[C#]
public class HeaderItem
[C++]
public ref class HeaderItem
[JScript]
public class HeaderItem

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Public Constructors

HeaderItem Constructor Initializes a new instance of the HeaderItem class.

Public Properties

HeaderKey Gets or sets the key of the header.
HeaderValue Gets or sets the value of the header.

Public Methods

SubValue Gets the value of the sub-key of the header.

Example

[Visual Basic, C#, C++] To get the full samples of EAGetMail, please refer to Samples section.

[Visual Basic - Parse Headers]
Imports EAGetMail
Public Sub ParseHeaders()
    Dim oMail As New Mail("TryIt")
    oMail.Load("c:\test.eml", False)
    Dim oHeaders As HeaderCollection = oMail.Headers
    Dim count As Integer = oHeaders.Count
    For i As Integer = 0 To count - 1
        Dim oHeader As HeaderItem = oHeaders(i)
        Console.WriteLine("{0}: {1}", oHeader.HeaderKey, oHeader.HeaderValue)
    Next
End Sub


[C# - Parse Headers] using System; using EAGetMail; public static void ParseHeaders() { Mail oMail = new Mail("TryIt"); oMail.Load("c:\\test.eml", false); HeaderCollection oHeaders = oMail.Headers; int count = oHeaders.Count; for(int i = 0; i < count; i++) { HeaderItem oHeader = oHeaders[i] as HeaderItem; Console.WriteLine("{0}: {1}", oHeader.HeaderKey, oHeader.HeaderValue); } }
[C++/CLI - Parse Headers] using namespace System; using namespace EAGetMail; Void ParseHeaders() { Mail ^oMail = gcnew Mail("TryIt"); oMail->Load("c:\\test.eml", false); HeaderCollection ^oHeaders = oMail->Headers; int count = oHeaders->Count; for(int i = 0; i < count; i++) { HeaderItem ^oHeader = dynamic_cast<HeaderItem^>(oHeaders->Item[i]); Console::WriteLine("{0}: {1}", oHeader->HeaderKey, oHeader->HeaderValue); } }

See Also

Mail.Headers Property

Online Tutorials

Parse Email in C#
Parse Email in VB
Parse Email in C++/CLI