Occurs when the connection with the server is successfully established.
Namespace: MailBee.SmtpMailAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax Remarks This event indicates successful completion of the connection procedure, while
SocketConnected event (occurs before
Connected) indicates
the connection request from MailBee was accepted by the server, and the SMTP
connection procedure will now begin.
If POP-before-SMTP authentication is used and MailBee successfully connects to the POP3
server, this event is raised as well. The developer can examine
Protocol property value to determine whether the connection
was made to POP3 or SMTP server.
Examples This sample uses
Connected event to report
the successful connection status into console.
using System;
using MailBee;
using MailBee.SmtpMail;
class Sample
{
private static void OnConnected(object sender, ConnectedEventArgs e)
{
Console.WriteLine("Successfully connected to the server.");
}
static void Main(string[] args)
{
Smtp mailer = new Smtp();
mailer.SmtpServers.Add("smtp.domain.com");
mailer.Connected += new ConnectedEventHandler(OnConnected);
mailer.Connect();
mailer.Disconnect();
}
}
Imports System
Imports MailBee
Imports MailBee.SmtpMail
Class Sample
Private Shared Sub OnConnected(ByVal sender As Object, ByVal e As ConnectedEventArgs)
Console.WriteLine("Successfully connected to the server.")
End Sub
Shared Sub Main(ByVal args As String())
Dim mailer As New Smtp
mailer.SmtpServers.Add("smtp.domain.com")
AddHandler mailer.Connected, AddressOf OnConnected
mailer.Connect()
mailer.Disconnect()
End Sub
End Class
See Also