SmtpMessageSenderSubmitted Event |
Occurs after the sender of the mail message was 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 being sent to multiple SMTP servers (such as to SMTP MX servers in direct mode),
this event will be raised multiple times (once per each individual SMTP connection).
Examples This sample sends a message in direct send mode to 3 recipients on 2 domains.
MessageSenderSubmitted event is raised 2 times (for each domain).
Note |
---|
In some cases, it may be raised more than 2 times. If certain domain has more than one
SMTP MX server assigned, and sending to high-priority MX server failed after the message
sender has already been submitted, then backup MX servers are tried (so that the message sender
is submitted again, and so does MessageSenderSubmitted event). |
using System;
using MailBee;
using MailBee.SmtpMail;
class Sample
{
private static void OnMessageSenderSubmitted(object sender,
SmtpMessageSenderSubmittedEventArgs e)
{
Console.WriteLine("SMTP server accepted " + e.SenderEmail + " address");
}
static void Main(string[] args)
{
Smtp mailer = new Smtp();
mailer.DnsServers.Autodetect();
mailer.MessageSenderSubmitted +=
new SmtpMessageSenderSubmittedEventHandler(OnMessageSenderSubmitted);
mailer.To.AsString = "user1@domain1.com, user2@domain1.com, user2@domain2.com";
mailer.From.Email = "sender@domain.com";
mailer.Subject = "Test message";
mailer.Send();
Console.WriteLine("Message sent to: " + mailer.GetAcceptedRecipients().ToString());
}
}
Imports System
Imports MailBee
Imports MailBee.SmtpMail
Class Sample
Private Shared Sub OnMessageSenderSubmitted(ByVal sender As Object, ByVal e As SmtpMessageSenderSubmittedEventArgs)
Console.WriteLine("SMTP server accepted " & e.SenderEmail & " address")
End Sub
Shared Sub Main(ByVal args As String())
Dim mailer As New Smtp
mailer.DnsServers.Autodetect()
AddHandler mailer.MessageSenderSubmitted, AddressOf OnMessageSenderSubmitted
mailer.To.AsString = "user1@domain1.com, user2@domain1.com, user2@domain2.com"
mailer.From.Email = "sender@domain.com"
mailer.Subject = "Test message"
mailer.Send()
Console.WriteLine("Message sent to: " & mailer.GetAcceptedRecipients().ToString())
End Sub
End Class
See Also