ComponentPro UltimateMail

      DownloadPop3MessageAsync(Int32, Pop3EnvelopeParts) Method

      See AlsoMembers Options: Show AllLanguage Filter: AllSend comments on this topic to ComponentPro
      Asynchronously retrieves information about a message with the specified sequence number.

      Syntax

      public ExtendedAsyncResult<Pop3Message> DownloadPop3MessageAsync(
         int messageInboxIndex, 
         Pop3EnvelopeParts parts
      )

      Parameters

      messageInboxIndex
      The ordinal position of the message in the inbox. It must be in the range from 1 to MessageCount.
      parts
      The message elements to retrieve.

      Return Value

      An object that references the asynchronous operation.

      Examples

      Shows how to connect to a POP3 server and retrieve information of a message asynchronously.

      using System;
      using ComponentPro;
      using ComponentPro.Net.Mail;
      
      ...
      
      // Create a new instance of the Pop3 class.
      Pop3 client = new Pop3();
      
      // 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");
      
      // ... 
       
      // Download a mail message with sequence number 1.
      Pop3Message msg = await client.DownloadPop3MessageAsync(1, Pop3EnvelopeParts.MessageInboxIndex | Pop3EnvelopeParts.UniqueId);
      
      Console.WriteLine("Message downloaded successfully.");
      Console.WriteLine("Message ID: {0}, Unique Id: {1}", msg.MessageIdentifier, msg.Subject);
      
      // ... 
       
      // Disconnect.
      client.Disconnect();

      Shows how to connect to a POP3 server and retrieve information of a message asynchronously.

      using System;
      using ComponentPro;
      using ComponentPro.Net.Mail;
      
      ...
      
      public void DoDownloadPop3MessagePartsAsync()
      {
          // Create a new instance of the Pop3 class. 
          Pop3 client = new Pop3();
      
          // 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");
      
          // ... 
       
          // Register an event handler. 
          client.DownloadPop3MessageCompleted += client_DownloadPop3MessageCompleted;
      
          // Download a mail message with sequence number 1. 
          client.DownloadPop3MessageAsync(1, Pop3EnvelopeParts.MessageInboxIndex | Pop3EnvelopeParts.UniqueId);
      
          // ... 
       
          // Disconnect. 
          client.Disconnect();
      }
      
      void client_DownloadPop3MessageCompleted(object sender, ExtendedAsyncCompletedEventArgs<Pop3Message> e)
      {
          // Pop3 client = (Pop3)sender; 
          if (e.Error != null)
              Console.WriteLine("Error: " + e.Error.ToString());
          else 
          {
              Console.WriteLine("Message downloaded successfully.");
              Console.WriteLine("Message ID: {0}, Unique Id: {1}", e.Result.MessageIdentifier, e.Result.Subject);
          }
      }

      Framework

      .NET Compact Framework.NET Compact Framework

      Supported version: 2.0, 3.5, and 3.9
      Assembly: ComponentPro.Mail.CF (in ComponentPro.Mail.CF.dll)

      .NET Framework.NET Framework

      Supported version: 2.0, 3.0, 3.5, 4.0, 4.5.x, 4.6.x and later
      Assembly: ComponentPro.Mail (in ComponentPro.Mail.dll)

      See Also