473,513 Members | 2,677 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Some get error failure sending mail ( System.Net.Mail)

Using System.Net.Mail: Sometimes I get error 'failure sending mail.
Unable to write data to the transport connection: An existing
connection was forcibly closed by the remote host.' Not sure how to
fix this error.

I am able to send messages sometimes both other times randomly
following error appear
EXCEPTION:
Exception of type 'System.Web.HttpUnhandledException' was thrown.
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(Http Context
context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.coursecert_presenter_main_aspx.ProcessRequest( HttpContext
context)
at
System.Web.HttpApplication.CallHandlerExecutionSte p.System.Web.HttpApplication.IExecutionStep.Execut e()
at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step,
Boolean& completedSynchronously)
INNER EXCEPTION:
Failure sending mail.
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at coursecert.utility.SendEmail(Object from_email, Object
from_name, Object to_email, Object email_subject, Object
email_message)
at coursecert.utility.SendAMail(String email_subject, String
email_message, Int32 cert_tracking_id, String email_to)
at ASP.coursecert_presenter_main_aspx.SendMail(Int32 message_ind)
at
ASP.coursecert_presenter_main_aspx.btnSendtoPRODUC TION_click(Object
sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEven t(String
eventArgument)
at
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint)
INNER EXCEPTION:
Unable to write data to the transport connection: An existing
connection was forcibly closed by the remote host.
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32
offset, Int32 size)
at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32
size)
at System.Net.Mail.SmtpConnection.Flush()
at System.Net.Mail.CheckCommand.Send(SmtpConnection conn, String&
response)
at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[]
command, String from)
at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender,
MailAddressCollection recipients, String deliveryNotify,
SmtpFailedRecipientException& exception)
at System.Net.Mail.SmtpClient.Send(MailMessage message)
INNER EXCEPTION:
An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset,
Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32
offset, Int32 size)

Sep 21 '07 #1
2 6808
>An existing connection was forcibly closed by the remote host

Without seeing any code, the first thing that comes to mind (and has caught
me on a few projects) has been various anti-virus softwares blocking port
25 or the SMTP server you're using hasn't been provided with the correct
authentication information.

If you can, post up your code.

-dl

--
David R. Longnecker
http://blog.tiredstudent.com
Using System.Net.Mail: Sometimes I get error 'failure sending mail.
Unable to write data to the transport connection: An existing
connection was forcibly closed by the remote host.' Not sure how to
fix this error.

I am able to send messages sometimes both other times randomly
following error appear

EXCEPTION:
Exception of type 'System.Web.HttpUnhandledException' was thrown.
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(Http Context
context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.coursecert_presenter_main_aspx.ProcessRequest( HttpContext
context)
at
System.Web.HttpApplication.CallHandlerExecutionSte p.System.Web.HttpApp
lication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step,
Boolean& completedSynchronously)
INNER EXCEPTION:
Failure sending mail.
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at coursecert.utility.SendEmail(Object from_email, Object
from_name, Object to_email, Object email_subject, Object
email_message)
at coursecert.utility.SendAMail(String email_subject, String
email_message, Int32 cert_tracking_id, String email_to)
at ASP.coursecert_presenter_main_aspx.SendMail(Int32 message_ind)
at
ASP.coursecert_presenter_main_aspx.btnSendtoPRODUC TION_click(Object
sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEven t(String
eventArgument)
at
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.R
aisePostBackEvent(String
eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint)
INNER EXCEPTION:
Unable to write data to the transport connection: An existing
connection was forcibly closed by the remote host.
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32
offset, Int32 size)
at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32
size)
at System.Net.Mail.SmtpConnection.Flush()
at System.Net.Mail.CheckCommand.Send(SmtpConnection conn, String&
response)
at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[]
command, String from)
at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender,
MailAddressCollection recipients, String deliveryNotify,
SmtpFailedRecipientException& exception)
at System.Net.Mail.SmtpClient.Send(MailMessage message)
INNER EXCEPTION:
An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset,
Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32
offset, Int32 size)

Sep 21 '07 #2
On Sep 21, 11:24 am, David R. Longnecker
<dlongnec...@community.nospamwrote:
An existing connection was forcibly closed by the remote host

Without seeing any code, the first thing that comes to mind (and has caught
me on a few projects) has been various anti-virus softwares blocking port
25 or the SMTP server you're using hasn't been provided with the correct
authentication information.

If you can, post up your code.

-dl

--
David R. Longneckerhttp://blog.tiredstudent.com
Using System.Net.Mail: Sometimes I get error 'failure sending mail.
Unable to write data to the transport connection: An existing
connection was forcibly closed by the remote host.' Not sure how to
fix this error.
I am able to send messages sometimes both other times randomly
following error appear
EXCEPTION:
Exception of type 'System.Web.HttpUnhandledException' was thrown.
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(Http Context
context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.coursecert_presenter_main_aspx.ProcessRequest( HttpContext
context)
at
System.Web.HttpApplication.CallHandlerExecutionSte p.System.Web.HttpApp
lication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step,
Boolean& completedSynchronously)
INNER EXCEPTION:
Failure sending mail.
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at coursecert.utility.SendEmail(Object from_email, Object
from_name, Object to_email, Object email_subject, Object
email_message)
at coursecert.utility.SendAMail(String email_subject, String
email_message, Int32 cert_tracking_id, String email_to)
at ASP.coursecert_presenter_main_aspx.SendMail(Int32 message_ind)
at
ASP.coursecert_presenter_main_aspx.btnSendtoPRODUC TION_click(Object
sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEven t(String
eventArgument)
at
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.R
aisePostBackEvent(String
eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint)
INNER EXCEPTION:
Unable to write data to the transport connection: An existing
connection was forcibly closed by the remote host.
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32
offset, Int32 size)
at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32
size)
at System.Net.Mail.SmtpConnection.Flush()
at System.Net.Mail.CheckCommand.Send(SmtpConnection conn, String&
response)
at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[]
command, String from)
at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender,
MailAddressCollection recipients, String deliveryNotify,
SmtpFailedRecipientException& exception)
at System.Net.Mail.SmtpClient.Send(MailMessage message)
INNER EXCEPTION:
An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset,
Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32
offset, Int32 size)- Hide quoted text -

- Show quoted text -

Here is the code.. It work fine sometimes, but when this function is
called repealy, then it break down!..
Sub sendAmail()
Dim send_mail_ip As String =
System.Configuration.ConfigurationManager.AppSetti ngs("send_mail_ip")
Dim mail As New MailMessage()

If Trim(txtToEmail.Text) <String.Empty And
Trim(send_mail_ip) <String.Empty Then
Dim smtp As New SmtpClient(Trim(send_mail_ip))
mail.From = New MailAddress(Trim(txtFromEmail.Text),
Trim(txtFromEmail.Text))
mail.To.Add(Trim(txtToEmail.Text))
mail.Subject = txtSubject.Text
mail.Body = txtMessage.Text

smtp.Send(mail)

lblAlert.Text = "<font color =""green"">Email Send</font>"
End If

End Sub

Sep 21 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
391
by: remove | last post by:
The original message was included as attachment test; hi; hello; Mail Delivery System; Mail Transaction Failed; Server Report; Status; Error; Test; Hi; Hello; Encrypted Mail; Virus sample; abuse?; feel free to use it; Excel file; Details; fake; read it immediately; something for you; information; order; encrypted document; file is bad; your...
2
3241
by: Kups | last post by:
Hi! I have a service and client that use WSE 2.0 and soap.tcp. Both are behind firewalls. Client connects to a public machine's tcp port which is redirected to service. If I send a request to service, it is received, but I can't get the answer. Here is the message from event log:
3
57589
by: HoustonComputerGuy | last post by:
I am working on getting my web applications moved to .Net 2.0 and am having some problems with System.Net.Mail. I get the following error when sending the mail: System.Net.Mail.SmtpException was unhandled by user code Message="Failure sending mail." Source="System" StackTrace: at System.Net.Mail.SmtpClient.Send(MailMessage message) at...
2
10129
by: HK | last post by:
In VB.NET, I'm getting the exception "failure sending mail". I'm running VS 2005 on XP Home. This is a new install on a new PC. I've never had email problems with VS 2003, and there I could modify the SMTP settings in IIS. But with this install, there is no IIS (at least I can't find an IIS with MMC browsing the snap-ins). I suspect that...
3
1967
by: mfleet1973 | last post by:
Hello Again. I have a program that sends e-mails as follows: Try Dim mail As New MailMessage mail.To = "me@comp.com" mail.From = "me@comp.com mail.Subject = "Test" mail.Body = "Testing123"
1
1673
by: NW Technicals | last post by:
I am trying to send email using this fucntion can you guys help me please find the mistake I am using my Gmail Credentials and the only exception error I get is Failure sending email Any help is greatly appreciated =====================
9
3434
by: JoeP | last post by:
Hi All, How can I find the reason for such an error: Failure sending mail. Some Code... oMailMessage.IsBodyHtml = False oMailMessage.Body = cEmailBody Dim oSMTP As New SmtpClient oSMTP.Send(oMailMessage) (in this line I am getting the above err)
5
4671
by: Don Quijote de Nicaragua | last post by:
Hi, everyone I try to send a simple e-mail witch this Code, but always send me a error messages: "ERROR: Failure sending mail." Thansk You. Don Quijote de Nicaragua. Elder Soto. Dim correo As New System.Net.Mail.MailMessage() correo.From = New System.Net.Mail.MailAddress("MyAco...@turbonett.com.ni")
1
6128
maliksleo
by: maliksleo | last post by:
hi i am using the following class for email sending but getting this error "Failure sending mail" Imports System.Net.Mail Public Class MailHelper ''' <summary> ''' Sends an mail message ''' </summary> ''' <param name="from">Sender address</param> ''' <param name="recepient">Recepient address</param>
0
7269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7394
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7123
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4756
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3248
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
1611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.