Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
Email .NET
>
Tutorial
> Retrieve message header
This example shows you how to login to POP3 server and display headers of all messages.
C# example
using System; using Independentsoft.Email; using Independentsoft.Email.Pop3; namespace Sample { class Program { static void Main(string[] args) { Pop3Client client = new Pop3Client("pop3.live.com", 995); client.Connect(); client.Login("example@hotmail.com", "password"); MessageInfo[] messageInfo = client.List(); for (int i = 0; i < messageInfo.Length; i++) { string header = client.GetHeader(messageInfo[i].Index); Console.WriteLine(header); Console.WriteLine("-----------------------------------------------"); } client.Disconnect(); Console.WriteLine("Press ENTER to exit!"); Console.Read(); } } }
VB example
Imports System Imports Independentsoft.Email Imports Independentsoft.Email.Pop3 Namespace Sample Class Program Shared Sub Main(ByVal args As String()) Dim client As New Pop3Client("pop3.live.com", 995) client.Connect() client.Login("example@hotmail.com", "password") Dim messageInfo As MessageInfo() = client.List() For i As Integer = 0 To messageInfo.Length - 1 Dim header As String = client.GetHeader(messageInfo(i).Index) Console.WriteLine(header) Console.WriteLine("-----------------------------------------------") Next client.Disconnect() Console.WriteLine("Press ENTER to exit!") Console.Read() End Sub End Class End Namespace