未能发送邮件。无法将数据写入到传输连接 [英] Failure sending mail. Unable to write data to the transport connection

查看:681
本文介绍了未能发送邮件。无法将数据写入到传输连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Gmail的SMTP服务器从VB.Net发送邮件。虽然发送一些电子邮件罚款,对另一些人则返回了以下错误:

  

未能发送邮件。无法将数据写入传输连接System.Net.Sockets.SocketException:一个已建立的连接被你的主机上的软件终止

解决方案

我正经历着同样的问题,最近与 SmtpClient.SendMail(MailMessage)被反复使用的电子邮件使用有350K的附件。每33消息,会出现你给的错误。

原来它封装sendmail的功能,并没有叫处置我们的共享组件() SmtpClient 类时消息被发送完。

添加 client.Dispose()的SmtpClient实例,清除了问题,正确的了,现在消息出去没问题 - 数百人(是的,他们是合法的产品我们的客户通知,不是垃圾邮件);)

I am using a Gmail SMTP server to send mail from VB.Net. Although it sends some emails fine, for some others it returns the following error:

Failure sending mail. Unable to write data to the transport connection System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine

解决方案

I was experiencing this same issue recently with SmtpClient.SendMail(MailMessage) being used repeatedly with an email with a 350k attachment. Every 33rd message, the error you gave would occur.

Turns out our shared component which encapsulated the SendMail functionality was not calling Dispose() on the SmtpClient class when the message was finished sending.

Adding client.Dispose() to the SmtpClient instance cleared the problem right up and now messages go out no problem - hundreds of them (and yes they're legitimate product notifications to our customers, not spam) ;)

这篇关于未能发送邮件。无法将数据写入到传输连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆