Pop3BeginLogin Method

Note: This API is now obsolete.

Begins an asynchronous request for a logging in an account on a POP3 server.

Namespace: MailBee.Pop3Mail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax
[ObsoleteAttribute("This method is obsolete in .NET 4.5+. Use LoginAsync instead.")]
public IAsyncResult BeginLogin(
	string targetName,
	string domain,
	string accountName,
	string password,
	AuthenticationMethods authMethods,
	AuthenticationOptions authOptions,
	SaslMethod authUserDefined,
	AsyncCallback callback,
	Object state
)

Parameters

targetName
Type: SystemString
The Service Principal Name of the server. Used only with GSSAPI/Kerberos authentication. You can leave it a null reference (Nothing in Visual Basic) or an empty string.
domain
Type: SystemString
The user account domain on the server. Used only with NTLM and GSSAPI authentication. You can leave it a null reference to use the current domain.
accountName
Type: SystemString
The user account name on the server. You can leave it a null reference when using NTLM or GSSAPI and wish to authenticate as the current Windows user.
password
Type: SystemString
The password of the user account on the server.
authMethods
Type: MailBeeAuthenticationMethods
A set of authentication methods which can be used when logging in a mailbox.
authOptions
Type: MailBeeAuthenticationOptions
Specifies the options which affect login process.
authUserDefined
Type: MailBeeSaslMethod
A reference to the instance of user defined authentication method, or a null reference (Nothing in Visual Basic) if user defined authentication is not used.
callback
Type: SystemAsyncCallback
The AsyncCallback delegate. You can leave it a null reference (Nothing in Visual Basic) if you do not use callbacks.
state
Type: SystemObject
An object that contains state information for this request. You can leave it a null reference (Nothing in Visual Basic).

Return Value

Type: IAsyncResult
An IAsyncResult that references the asynchronous login process.
Exceptions
ExceptionCondition
MailBeeInvalidStateExceptionThere is already an operation in progress.
Remarks
Examples
This sample demonstrates asynchronous logging in a mailbox and use of a callback function in a console application.
using System;
using MailBee;
using MailBee.Pop3Mail;

class Sample
{
    // A callback function.
    private static void LoginCallback(IAsyncResult result)
    {
        Pop3 pop = (Pop3)result.AsyncState;
        pop.EndLogin();
        Console.WriteLine("Overall size of all messages in the inbox is " +
            pop.InboxSize + " bytes");
    }

    // The actual code.
    static void Main(string[] args)
    {
        Pop3 pop = new Pop3();

        pop.Connect("pop.somehost.com");

        // Initiate an asynchronous login attempt.
        IAsyncResult ar = pop.BeginLogin(null, null, "jdoe", "secret",
            AuthenticationMethods.Auto, AuthenticationOptions.None,
            null, new AsyncCallback(LoginCallback), pop);

        // Simulate some lengthy work here. At the same time,
        // login is executed on another thread.
        System.Threading.Thread.Sleep(3000);

        // If the login attempt is still in progress, then wait until it's finished.
        while (pop.IsBusy) ar.AsyncWaitHandle.WaitOne();

        // Disconnect from the server.
        pop.Disconnect();
    }
}
See Also