SmtpMessageMXLookupDone Event |
Occurs in direct send mode after the component finished DNS MX lookup
of SMTP MX servers of recipients domains.
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 without SMTP relay server directly to MX servers
of recipient domains, the component must first discover these servers by
performing MX lookup queries to DNS servers. Once this process is finished, the
component raises MessageMXLookupDone and starts submitting the mail
message to the discovered MX servers.
Examples This sample sends a message in direct send mode to 3 recipients on 2 domains.
MessageMXLookupDone event is raised 1 time.
using System;
using System.Collections;
using MailBee;
using MailBee.SmtpMail;
class Sample
{
private static void OnMessageMXLookupDone(object sender,
SmtpMessageMXLookupDoneEventArgs e)
{
string domains = string.Join(", ",
(string[])ArrayList.Adapter(e.SuccessfulDomains).ToArray(typeof(string)));
Console.WriteLine("Will send to MX servers of the following domains: " + domains);
}
static void Main(string[] args)
{
Smtp mailer = new Smtp();
mailer.DnsServers.Autodetect();
mailer.MessageMXLookupDone +=
new SmtpMessageMXLookupDoneEventHandler(OnMessageMXLookupDone);
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("Sent to: " + mailer.GetAcceptedRecipients().ToString());
}
}
Imports System
Imports System.Collections
Imports MailBee
Imports MailBee.SmtpMail
Class Sample
Private Shared Sub OnMessageMXLookupDone(ByVal sender As Object, _
ByVal e As SmtpMessageMXLookupDoneEventArgs)
Dim domains As String
domains = String.Join(", ", ArrayList.Adapter(e.SuccessfulDomains).ToArray())
Console.WriteLine("Will send to MX servers of the following domains: " & domains)
End Sub
Shared Sub Main(ByVal args As String())
Dim mailer As New Smtp
mailer.DnsServers.Autodetect()
AddHandler mailer.MessageMXLookupDone, AddressOf OnMessageMXLookupDone
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("Sent to: " & mailer.GetAcceptedRecipients().ToString())
End Sub
End Class
See Also