HeaderItem Constructor


Initializes a new instance of the HeaderItem class.

[Visual Basic]
Public Sub New(
    headerKey As String, _
    headerValue As String _
)

Public Sub New( _
    keyvalue As String _
)
[C#]
public HeaderItem(
    string headerKey,
    string headerValue
);

public HeaderItem(
    string keyvalue
);
[C++]
public: HeaderItem(
    String^ headerKey,
    String^ headerValue
);

public: HeaderItem(
    String^ keyvalue
);
[JScript]
public function HeaderItem(
    headerKey : String,
    headerValue : String
);

public function HeaderItem(
    keyvalue : String
);

Parameters

keyvalue
A colon-delimited string (headerKey:headerValue).
headerKey
The header key.
headerValue
The header value.

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