PowerTCP Mail for .NET
BeginLogin(String,Int32,String,Int32,String,String,PopLoginMethod,Object) Method
See Also  Send comments on this topic.
Dart.PowerTCP.Mail Namespace > Pop Class > BeginLogin Method : BeginLogin(String,Int32,String,Int32,String,String,PopLoginMethod,Object) Method




server
The POP server to log in to.
serverPort
The port to attempt to log in to.
client
The client hostname or address when a specific interface binding is desired
clientPort
The client port when a specific local port is desired
username
Username used to log in to the POP server.
password
Password used to log in to the POP server.
loginMethod
Login method to use.
state
User state information.
Asynchronously log in to a POP server (while explicitly specifying a local interface to use) and initialize the PopMessage array.

Syntax

Visual Basic (Declaration) 
Public Overloads Function BeginLogin( _
   ByVal server As String, _
   ByVal serverPort As Integer, _
   ByVal client As String, _
   ByVal clientPort As Integer, _
   ByVal username As String, _
   ByVal password As String, _
   ByVal loginMethod As PopLoginMethod, _
   ByVal state As Object _
) As IAsyncResult
Visual Basic (Usage)Copy Code
Dim instance As Pop
Dim server As String
Dim serverPort As Integer
Dim client As String
Dim clientPort As Integer
Dim username As String
Dim password As String
Dim loginMethod As PopLoginMethod
Dim state As Object
Dim value As IAsyncResult
 
value = instance.BeginLogin(server, serverPort, client, clientPort, username, password, loginMethod, state)
C# 
public IAsyncResult BeginLogin( 
   string server,
   int serverPort,
   string client,
   int clientPort,
   string username,
   string password,
   PopLoginMethod loginMethod,
   object state
)
Managed Extensions for C++ 
public: IAsyncResult* BeginLogin( 
   string* server,
   int serverPort,
   string* client,
   int clientPort,
   string* username,
   string* password,
   PopLoginMethod loginMethod,
   Object* state
) 
C++/CLI 
public:
IAsyncResult^ BeginLogin( 
   String^ server,
   int serverPort,
   String^ client,
   int clientPort,
   String^ username,
   String^ password,
   PopLoginMethod loginMethod,
   Object^ state
) 

Parameters

server
The POP server to log in to.
serverPort
The port to attempt to log in to.
client
The client hostname or address when a specific interface binding is desired
clientPort
The client port when a specific local port is desired
username
Username used to log in to the POP server.
password
Password used to log in to the POP server.
loginMethod
Login method to use.
state
User state information.

Return Value

An IAsyncResult that represents the asynchronous operation, which could still be pending.

Exceptions

ExceptionDescription
Dart.PowerTCP.Mail.ProtocolExceptionBad POP protocol response received from server.
System.InvalidOperationException Pop.BeginLogin used without providing an Pop.EndLogin event handler.
System.Net.Sockets.SocketExceptionThe requested address is not valid in its context.
System.IO.IOExceptionThe filename, directory name, or volume label syntax is incorrect.
System.ArgumentExceptionA required argument contains invalid characters, is empty, or contains only white spaces.

Remarks

This method begins to asynchronously log in to a POP server. Upon completion the Pop.EndLogin event will be raised. An PopEventArgs object will be passed into this event, containing data about the success/failure of the log in.

Upon logging in, the Pop.Message property will be populated with the new messages available on the POP server. The Pop component can be configured to populate the Pop.Message property with message data in one of three ways upon login:

  • If Pop.AutoGet = MessageSection.None the Pop.Messages collection will be populated with MessageStream objects containing the minimal data returned from the server about the message (id, unique id, and size of the message).
  • If Pop.AutoGet = MessageSection.Complete then the Pop.Messages collection will be populated with MessageStream objects containing the full message.
  • If Pop.AutoGet = MessageSection.Header then the Pop.Messages collection will be populated with MessageStream objects containing only the header.

Use this method when you want to asynchronously log in to a POP server using advanced options. The advanced options include the specification of a non-standard port (via the serverPort parameter) and the specification of a local interface to use (via the client and clientPort parameters).

If you are using the Pop component as a reference, you must "wire up" the event yourself. This involves creating a method that acts as the event handler that implements the PopEventHandler delegate. See Using Events When Using A Component As A Reference for more information.

The object state is useful for any kind of state information that you would like accessible in the Pop.EndLogin event. Since the method is "disconnected" from the calling code and returns to the main thread elsewhere, you may wish to pass an object/variable as state to be retrieved and used in the event handler.

To log in synchronously, use Pop.Login

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 3.2
© 2010 Dart Communications. All Rights Reserved.