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




Provides members for connecting to an IMAP4 server, searching, downloading, uploading e-mail messages. In addition to managing e-mail messages, it also allows you to manage IMAP mailbox easily.

Object Model



Syntax

Visual Basic (Declaration) 
<DescriptionAttribute("Provides members for connecting to an IMAP4 server, searching, downloading, uploading e-mail messages. In addition to managing e-mail messages, it also allows you to manage IMAP mailbox easily.")>
Public Class ImapClient 
   Inherits Component
Visual Basic (Usage)Copy Code
Dim instance As ImapClient
C# 
[DescriptionAttribute("Provides members for connecting to an IMAP4 server, searching, downloading, uploading e-mail messages. In addition to managing e-mail messages, it also allows you to manage IMAP mailbox easily.")]
public class ImapClient : Component 
Managed Extensions for C++ 
[DescriptionAttribute("Provides members for connecting to an IMAP4 server, searching, downloading, uploading e-mail messages. In addition to managing e-mail messages, it also allows you to manage IMAP mailbox easily.")]
public __gc class ImapClient : public Component 
C++/CLI 
[DescriptionAttribute("Provides members for connecting to an IMAP4 server, searching, downloading, uploading e-mail messages. In addition to managing e-mail messages, it also allows you to manage IMAP mailbox easily.")]
public ref class ImapClient : public Component 

Example

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

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

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

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

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

           StringBuilder sb =
new StringBuilder();

           MailboxCollection list = client.ListMailboxes();
           
for (int i = 0; i < list.Count; i++)
           {
               sb.AppendFormat(
"{0} - {1}\r\n", i + 1, list[i].Name);
           }

           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 Connect
    Sub Main()
        ' Create a new instance of the ImapClient class.
        Dim client As New ImapClient()

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

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

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

        Dim sb As New StringBuilder()

        Dim list As MailboxCollection = client.ListMailboxes()
        For i As Integer = 0 To list.Count - 1
            sb.AppendFormat("{0} - {1}" & Constants.vbCrLf, i + 1, list(i).Name)
        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.ImapClient

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