SmtpBeginHello Method

Note: This API is now obsolete.

Begins an asynchronous request for sending initial greeting to the SMTP server.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.2.0 build 630 for .NET 4.5
[ObsoleteAttribute("This method is obsolete in .NET 4.5+. Use HelloAsync instead.")]
public IAsyncResult BeginHello(
	AsyncCallback callback,
	Object state


Type: SystemAsyncCallback
The AsyncCallback delegate. You can leave it a null reference (Nothing in Visual Basic) if you do not use callbacks.
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 greeting.
MailBeeInvalidStateExceptionThere is already an operation in progress.
This console sample connects to the SMTP server, sends greeting asynchronously, and handles ErrorOccurred event to trap the warning telling that EHLO is not supported, and HELO will be tried (this warning event will be raised only if the server is not ESMTP enabled). No callback function is used.
using System;
using MailBee;
using MailBee.SmtpMail;

class Sample
    // ErrorOccurred event handler.
    private static void OnErrorOccurred(object sender, ErrorEventArgs e)
        if (e.Reason is MailBeeSmtpOptionalCommandNotSupportedException)
            Console.WriteLine(e.Reason.Message); // EHLO not supported.

    // The actual code.
    static void Main(string[] args)
        Smtp mailer = new Smtp();



        // Subscribe to the ErrorOccurred event. We subcribe only for the time 
        // of Hello() method execution to make sure the trapped warnings do not 
        // relate to execution of any other methods.
        mailer.ErrorOccurred += new ErrorEventHandler(OnErrorOccurred);

        // Initiate an asynchronous greeting.
        mailer.BeginHello(null, null);

        // Simulate some lengthy work here. At the same time, 
        // the greeting is performed on another thread.

        // End the connection request.

        mailer.ErrorOccurred -= new ErrorEventHandler(OnErrorOccurred);

See Also