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.4 build 677 for .NET 4.5
public event SmtpMessageRecipientSubmittedEventHandler MessageRecipientSubmitted


Type: MailBee.SmtpMailSmtpMessageRecipientSubmittedEventHandler
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.
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");
            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.

        // Subscribe to the MessageRecipientSubmitted event.
        mailer.MessageRecipientSubmitted +=
            new SmtpMessageRecipientSubmittedEventHandler(OnMessageRecipientSubmitted);

        // Send a message to 3 recipients on 2 domains.
        mailer.To.AsString = ",,";
        mailer.From.Email = "";
        mailer.Subject = "Test message";

        Console.WriteLine("Message sent to: " + mailer.GetAcceptedRecipients().ToString());
See Also