Email Send Failure [closed]

2019-09-20 08:49发布

问题:

If I've list of emailTo address and one of them is invalid.

Does client.Send(email); returns failure/Exception?

回答1:

Yes the SMTPClient's Send(MailMessage) method raises a SmtpFailedRecipientsException exception if one or more recipient addresses were incorrect or unreachable.



回答2:

Yes and no. For server local addresses (if you send from abc@domain.com to def@domain.com) mail server may return error immediately, but generally speaking mail server processes requests asynchronously and does not return any error if recipient address is invalid.



回答3:

This is all in the documentation of the SmtpClient class, which you should always read before asking:

When sending e-mail using Send to multiple recipients and the SMTP server accepts some recipients as valid and rejects others, Send sends e-mail to the accepted recipients and then a SmtpFailedRecipientsException is thrown. The exception will contain a listing of the recipients that were rejected.



标签: c# .net smtp