SmtpBeginLogin Method

Note: This API is now obsolete.

Begins an asynchronous request for authenticating the user on the SMTP server.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
[ObsoleteAttribute("This method is obsolete in .NET 4.5+. Use LoginAsync instead.")]
public IAsyncResult BeginLogin(
	AsyncCallback callback,
	Object state
)

Parameters

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 authentication.
Exceptions
ExceptionCondition
MailBeeInvalidStateExceptionThere is already an operation in progress.
Remarks
Examples
This WinForms sample demonstrates using asynchronous authentication in conjunction with a callback function.
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.SmtpMail;

// Put the code below inside your class.

// Login callback function.
private void LoginCallback(IAsyncResult result)
{
    Smtp mailer = (Smtp)result.AsyncState;

    mailer.EndLogin();
    MessageBox.Show("Authentication succeeded");

    // Close the connection.
    mailer.Disconnect();
}

// The actual code.
private void Form1_Load(object sender, System.EventArgs e)
{
    Smtp mailer = new Smtp();

    mailer.SmtpServers.Add("smtp.somehost.com", "jdoe", "secret");

    // Connect to SMTP server and say Hello.
    mailer.Connect();
    mailer.Hello();

    // Initiate an asynchronous authentication attempt.
    mailer.BeginLogin(new AsyncCallback(LoginCallback), mailer);
}
See Also