C# SMTPClient 超时问题
我想知道,您是否真的需要手动增加发送操作的超时才能发送大附件。我阅读了位于此处 它表示超时长度为 100 秒。我想知道是否可以直接告诉它继续运行,直到发现错误或邮件消息发送成功,而不是使用超时?
I was wondering, do you really have to increase the timeout of a send operation manually for sending large attachments. I read the Microsoft documentation located here and it says the timeout length is 100 seconds. Instead of working with timeout, I was wondering if its possible to rather just tell it to continue going until either an error is found or the mail message is sent successfully?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您链接的页面已经给出了答案:使用 SendAsync 方法。来自 SendAsync 文档:
SendCompleted 事件需要一个 SendCompletedEventHandler 委托,该委托又接收一个 < a href="http://msdn.microsoft.com/en-us/library/x5x13z6h.aspx" rel="nofollow noreferrer">AsyncCompletedEventArgs 实例,可用于判断发送是否成功。
The very page you link already gives the answer: use the SendAsync method. From the SendAsync documentation:
The SendCompleted event requires a SendCompletedEventHandler delegate, which in turn receives a AsyncCompletedEventArgs instance, which can be used to find out whether sending succeeded.