SmtpMessageMXLookupDone Event
Occurs in direct send mode after the component finished DNS MX lookup of SMTP MX servers of recipients domains.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax
public event SmtpMessageMXLookupDoneEventHandler MessageMXLookupDone

Value

Type: MailBee.SmtpMailSmtpMessageMXLookupDoneEventHandler
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
{
    // MessageMXLookupDone event handler.
    private static void OnMessageMXLookupDone(object sender,
        SmtpMessageMXLookupDoneEventArgs e)
    {
        // Create and display comma-separated list of domains for which 
        // SMTP MX servers have been found.
        string domains = string.Join(", ",
            (string[])ArrayList.Adapter(e.SuccessfulDomains).ToArray(typeof(string)));

        Console.WriteLine("Will send to MX servers of the following domains: " + domains);
    }

    // The actual code.
    static void Main(string[] args)
    {
        Smtp mailer = new Smtp();

        // Get DNS servers from config file/OS settings.
        mailer.DnsServers.Autodetect();

        // Subscribe to the MessageMXLookupDone event.
        mailer.MessageMXLookupDone +=
            new SmtpMessageMXLookupDoneEventHandler(OnMessageMXLookupDone);

        // Send a message to 3 recipients on 2 domains.
        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());
    }
}
See Also