SmtpMessageSubmittedToServer Event |
Occurs each time the message is successfully submitted to the SMTP server.
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 for each SMTP server the message was successfully submitted to.
Examples This sample sends a message in direct send mode to 3 recipients on 2 domains.
MessageSubmittedToServer event is raised 2 times (for each domain).
using System;
using MailBee;
using MailBee.SmtpMail;
class Sample
{
private static void OnMessageSubmittedToServer(object sender,
SmtpMessageSubmittedToServerEventArgs e)
{
Console.WriteLine(e.AcceptedRecipients.ToString() + " accepted");
}
static void Main(string[] args)
{
Smtp mailer = new Smtp();
mailer.DnsServers.Autodetect();
mailer.MessageSubmittedToServer +=
new SmtpMessageSubmittedToServerEventHandler(OnMessageSubmittedToServer);
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 OnMessageSubmittedToServer(ByVal sender As Object, _
ByVal e As SmtpMessageSubmittedToServerEventArgs)
Console.WriteLine(e.AcceptedRecipients.ToString() & " accepted")
End Sub
Shared Sub Main(ByVal args As String())
Dim mailer As New Smtp
mailer.DnsServers.Autodetect()
AddHandler mailer.MessageSubmittedToServer, AddressOf OnMessageSubmittedToServer
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