SmtpMessageDirectSendDone Event
Occurs in direct send mode when the component finished submitting the mail message to all SMTP MX servers of recipients domains.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax
public event SmtpMessageDirectSendDoneEventHandler MessageDirectSendDone

Value

Type: MailBee.SmtpMailSmtpMessageDirectSendDoneEventHandler
Remarks
In direct send mode, MessageDirectSendDone event is immediately followed by MessageSent event. However, if some recipients of the message failed and SmtpServers collection contains low priority SMTP relay servers (with priority value lower than top priority DNS server in DnsServers collection), the component will attempt to send the message to the failed recipients using these low priority SMTP relay servers. In this case, MessageSent event is raised noticeably later than MessageDirectSendDone event (after the message was also sent to the backup SMTP relay servers).
Examples
This sample sends a message in direct send mode to 3 recipients on 2 domains. MessageDirectSendDone event is raised 1 time. However, a backup SMTP relay server is then used in order to send to the recipients failed during direct send. MessageDirectSendDone and MessageSent events are raised 1 time.
using System;
using MailBee;
using MailBee.SmtpMail;

class Sample
{
    // MessageDirectSendDone event handler.
    private static void OnMessageDirectSendDone(object sender,
        SmtpMessageDirectSendDoneEventArgs e)
    {
        Console.WriteLine("Sent using direct send to: " +
            e.SuccessfulRecipients.ToString());
    }

    // MessageSent event handler.
    private static void OnMessageSent(object sender,
        SmtpMessageSentEventArgs e)
    {
        Console.WriteLine("In the long run, sent to: " +
            e.SuccessfulRecipients.ToString());
    }

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

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

        // Specify backup SMTP server and enable ESMTP authentication.
        // Note, depending on your SMTP server settings, either 
        // "jdoe" or "jdoe@domain.com" should be used as user account name.
        SmtpServer server = new SmtpServer("mail.isp.com", "jdoe", "secret");
        server.Priority = 100; // low priority
        mailer.SmtpServers.Add(server);

        // Subscribe to events.
        mailer.MessageDirectSendDone +=
            new SmtpMessageDirectSendDoneEventHandler(OnMessageDirectSendDone);
        mailer.MessageSent += new SmtpMessageSentEventHandler(OnMessageSent);

        // Send a message to 3 recipients on 2 domains. Let's assume we send 
        // from a domain which has no its own MX record, and domain1.com checks 
        // this and rejects our message to user1@domain1.com. In this case, 
        // the message will be delivered to user1@domain1.com using ISP's mail 
        // server (we assume ISP's mail server has MX record assigned).
        mailer.To.AsString = "user1@domain1.com, user2@domain1.com, user2@domain2.com";
        mailer.From.Email = "sender@domain.com";
        mailer.Subject = "Test message";
        mailer.Send();
    }
}
See Also