Email Send Failure [closed]

2019-09-20 08:16发布

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

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

标签: c# .net smtp
3条回答
做自己的国王
2楼-- · 2019-09-20 08:58

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.

查看更多
Ridiculous、
3楼-- · 2019-09-20 08:59

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

查看更多
做自己的国王
4楼-- · 2019-09-20 09:03

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.

查看更多
登录 后发表回答