Not able to get 'RejectedRecipients' .

0 votes
asked Nov 4, 2016 by Praneeth (120 points)

Hi ,
Went through your study material and found two ways to get list of rejected recipients,if any when email is sent using Rebex Smtp.

1) Using Rebex.Net.Smtp.SendDirect() ;

            SmtpRejectedRecipient[] rejected = Rebex.Net.Smtp.SendDirect(MailMessage);
            MessageBox.Show("Rejected Recipients count: " + rejected.Count());

2) Using RejectedRecipient event

            smtpObject.RejectedRecipient += smtpObject_RejectedRecipient;
            smtpObject.Send(MailMessage );

            private void smtpObject_RejectedRecipient(object sender, SmtpRejectedRecipientEventArgs e)


Did implement both with rebex latest dlls. Could not get rejected recipients list. Does rebex Smtp support giving list of rejected recipients?

Applies to: Rebex Secure Mail

1 Answer

0 votes
answered Nov 4, 2016 by Lukas Pokorny (82,430 points)

Yes, both of these methods provide a list of rejected receipients - if one or more recipients have actually been rejected by the SMTP server.

Testing this is quite simple:

mail.From = "";
mail.To = "";
mail.Subject = "Sample subject";
mail.BodyText = "Sample text.";

SmtpRejectedRecipient[] rejected = Smtp.SendDirect(mail);
foreach (var recipient in rejected)
    Console.WriteLine("Rejected '{0}':\n{1}\n", recipient.Address, recipient.Response.Raw);