我可能会在 System.Net.Mail.SendCompletedEventHandler 中收到哪些错误?
我正在使用 SendAsync 方法发送一些电子邮件。 SendCompletedEventHandler 的 AsyncCompletedEventArgs 中可能会返回哪些不同的错误?是否有处理这些问题的推荐做法?
I am using the SendAsync method to send some emails out. What different errors could possibly be returned in the AsyncCompletedEventArgs in the SendCompletedEventHandler? Is there recommended practices for handling these?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里一切皆有可能,您可能正在尝试与一个特别脾气暴躁的 SMTP 服务器通信。您无法处理代码中的错误,您的代码无法改变服务器的工作方式。需要人来弄清楚为什么服务器不喜欢您的消息。 SMTP 服务器可能返回的错误代码另有记录,请查看 SmtpStatusCode 枚举。
Anything is possible here, you might be trying to talk to a particularly cranky SMTP server. You can't handle errors in your code, your code can't change the way the server works. It takes a human to figure out why the server doesn't like your message. The error codes that can be returned by an SMTP server are otherwise documented, review the SmtpStatusCode enum.