SmtpMessageRecipientSubmitted Event
Occurs each time the next recipient in the mail message recipients list is accepted or refused by the SMTP server.

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

Value

Type: MailBee.SmtpMailSmtpMessageRecipientSubmittedEventHandler
Remarks
If the message contains multiple recipients, this event is raised for each recipient. The developer can use Result property to detremine whether the recipient was accepted or refused.
Note Note
If refused recipients are not allowed (AllowRefusedRecipients is false), the component will cancel the SMTP session after raising MessageRecipientSubmitted event.
Examples
This sample sends a message in direct send mode to 3 recipients on 2 domains. MessageSenderSubmitted event is raised 3 times (for each recipient).
Note 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 recipient has already been submitted, then backup MX servers are tried (so that the message recipient is submitted again, and so does MessageRecipientSubmitted event).
using System;
using MailBee;
using MailBee.SmtpMail;

class Sample
{
    // MessageRecipientSubmitted event handler.
    private static void OnMessageRecipientSubmitted(object sender,
        SmtpMessageRecipientSubmittedEventArgs e)
    {
        if (e.Result)
        {
            Console.WriteLine("SMTP server accepted " + e.RecipientEmail + " address");
        }
        else
        {
            Console.WriteLine("SMTP server refused " + e.RecipientEmail + " address");
        }
    }

    // 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 MessageRecipientSubmitted event.
        mailer.MessageRecipientSubmitted +=
            new SmtpMessageRecipientSubmittedEventHandler(OnMessageRecipientSubmitted);

        // 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("Message sent to: " + mailer.GetAcceptedRecipients().ToString());
    }
}
See Also