HeaderCollection Class


The collection of HeaderItem class.

System.Object
    System.Collections.ArrayList
        EAGetMail.HeaderCollection

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

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

HeaderCollection Constructor Initializes a new instance of the HeaderCollection class.

Methods and Properties

Please refer to .NET Framework SDK System.Collections.ArrayList.

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); } }

Remarks

To learn more detail about HeaderCollection, please refer to Mail.Headers property.

See Also

Mail.Headers Property

Online Tutorials

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