Occurs after the message was successfully sent.
Namespace: MailBee.SmtpMailAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax Remarks If the message is sent to multiple SMTP servers (common case in direct
send mode where the message is submitted to SMTP MX server of each recipient domain separately),
this event is raised after the message was submitted to all SMTP servers.
Examples This sample sends a message in direct send mode to 3 recipients on 2 domains.
MessageSent event is raised 1 time.
using System;
using MailBee;
using MailBee.SmtpMail;
class Sample
{
private static void OnMessageSent(object sender, SmtpMessageSentEventArgs e)
{
Console.WriteLine("Sent to: " + e.SuccessfulRecipients.ToString());
}
static void Main(string[] args)
{
Smtp mailer = new Smtp();
mailer.DnsServers.Autodetect();
mailer.MessageSent += new SmtpMessageSentEventHandler(OnMessageSent);
mailer.To.AsString = "user1@domain1.com, user2@domain1.com, user2@domain2.com";
mailer.From.Email = "sender@domain.com";
mailer.Subject = "Test message";
mailer.Send();
}
}
Imports System
Imports MailBee
Imports MailBee.SmtpMail
Class Sample
Private Shared Sub OnMessageSent(ByVal sender As Object, ByVal e As SmtpMessageSentEventArgs)
Console.WriteLine("Sent to: " & e.SuccessfulRecipients.ToString())
End Sub
Shared Sub Main(ByVal args As String())
Dim mailer As New Smtp
mailer.DnsServers.Autodetect()
AddHandler mailer.MessageSent, AddressOf OnMessageSent
mailer.To.AsString = "user1@domain1.com, user2@domain1.com, user2@domain2.com"
mailer.From.Email = "sender@domain.com"
mailer.Subject = "Test message"
mailer.Send()
End Sub
End Class
See Also