• Loading...
UltimateMail
Pop3Client Class
Members  Example  See Also  Send comments on this topic to ATP, Inc.
Atp.Net.Mail Namespace : Pop3Client Class




Provides members for connecting to a POP3 server and downloading and deleting e-mail messages from a user account inbox.

Object Model


Syntax

Visual Basic (Declaration) 
<DescriptionAttribute("Pop3Client provides methods for communication with POP3 servers.")>
Public Class Pop3Client 
   Inherits Component
Visual Basic (Usage)Copy Code
Dim instance As Pop3Client
C# 
[DescriptionAttribute("Pop3Client provides methods for communication with POP3 servers.")]
public class Pop3Client : Component 
Managed Extensions for C++ 
[DescriptionAttribute("Pop3Client provides methods for communication with POP3 servers.")]
public __gc class Pop3Client : public Component 
C++/CLI 
[DescriptionAttribute("Pop3Client provides methods for communication with POP3 servers.")]
public ref class Pop3Client : public Component 

Example

C#Copy Code
using System;
using System.Text;
using Atp.Net.Mail;

namespace Samples.Pop3
{
   
class Connect
   {
       
static void Main()
       {
           
// Create a new instance of the Pop3Client class.
           
Pop3Client client = new Pop3Client();

           
// Connect to the server.
           
client.Connect("myserver");

           
// Or you can specify the POP3 port with
           
// client.Connect("myserver", 110);

           
// Login to the server.
           
client.Authenticate("user", "password");

           StringBuilder sb =
new StringBuilder();

           Pop3MessageCollection list = client.ListMessages(EnvelopeParts.Size | EnvelopeParts.UniqueId);
           
for (int i = 0; i < list.Count; i++)
           {
               sb.AppendFormat(
"{0} - {1}\r\n", i + 1, list[i].UniqueId);
           }

           Console.WriteLine(sb.ToString());

           
// Close the connection.
           
client.Disconnect();
       }
   }
}
Visual BasicCopy Code
Imports Microsoft.VisualBasic
Imports System
Imports System.Text
Imports Atp.Net.Mail

Module Pop3Connect
    Sub Main()
        ' Create a new instance of the Pop3Client class.
        Dim client As New Pop3Client()

        ' Connect to the server.
        client.Connect("myserver")

        ' Or you can specify the POP3 port with
        ' client.Connect("myserver", 110);

        ' Login to the server.
        client.Authenticate("user", "password")

        Dim sb As New StringBuilder()

        Dim list As Pop3MessageCollection = client.ListMessages(EnvelopeParts.Size Or EnvelopeParts.UniqueId)
        For i As Integer = 0 To list.Count - 1
            sb.AppendFormat("{0} - {1}" & Constants.vbCrLf, i + 1, list(i).UniqueId)
        Next i

        Console.WriteLine(sb.ToString())

        ' Close the connection.
        client.Disconnect()
    End Sub
End Module

Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         Atp.Net.Mail.Pop3Client

Requirements

Namespace: Atp.Net.Mail

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: UltimateMail (in UltimateMail.dll)

See Also

ATP, Inc. is a Microsoft Partner. Our components are compatible with Windows 7 and optimized for Visual Studio