473,735 Members | 1,878 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.Htt pUnhandledExcep tion' was thrown.
at System.Web.UI.P age.HandleError (Exception e)
at System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
at System.Web.UI.P age.ProcessRequ est(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
at System.Web.UI.P age.ProcessRequ est()
at System.Web.UI.P age.ProcessRequ estWithNoAssert (HttpContext
context)
at System.Web.UI.P age.ProcessRequ est(HttpContext context)
at ASP.coursecert_ presenter_main_ aspx.ProcessReq uest(HttpContex t
context)
at
System.Web.Http Application.Cal lHandlerExecuti onStep.System.W eb.HttpApplicat ion.IExecutionS tep.Execute()
at System.Web.Http Application.Exe cuteStep(IExecu tionStep step,
Boolean& completedSynchr onously)
INNER EXCEPTION:
Failure sending mail.
at System.Net.Mail .SmtpClient.Sen d(MailMessage message)
at coursecert.util ity.SendEmail(O bject from_email, Object
from_name, Object to_email, Object email_subject, Object
email_message)
at coursecert.util ity.SendAMail(S tring email_subject, String
email_message, Int32 cert_tracking_i d, String email_to)
at ASP.coursecert_ presenter_main_ aspx.SendMail(I nt32 message_ind)
at
ASP.coursecert_ presenter_main_ aspx.btnSendtoP RODUCTION_click (Object
sender, EventArgs e)
at System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e)
at System.Web.UI.W ebControls.Butt on.RaisePostBac kEvent(String
eventArgument)
at
System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring
eventArgument)
at System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument)
at System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection
postData)
at System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean
includeStagesAf terAsyncPoint)
INNER EXCEPTION:
Unable to write data to the transport connection: An existing
connection was forcibly closed by the remote host.
at System.Net.Sock ets.NetworkStre am.Write(Byte[] buffer, Int32
offset, Int32 size)
at System.Net.Pool edStream.Write( Byte[] buffer, Int32 offset, Int32
size)
at System.Net.Mail .SmtpConnection .Flush()
at System.Net.Mail .CheckCommand.S end(SmtpConnect ion conn, String&
response)
at System.Net.Mail .MailCommand.Se nd(SmtpConnecti on conn, Byte[]
command, String from)
at System.Net.Mail .SmtpTransport. SendMail(MailAd dress sender,
MailAddressColl ection recipients, String deliveryNotify,
SmtpFailedRecip ientException& exception)
at System.Net.Mail .SmtpClient.Sen d(MailMessage message)
INNER EXCEPTION:
An existing connection was forcibly closed by the remote host
at System.Net.Sock ets.Socket.Send (Byte[] buffer, Int32 offset,
Int32 size, SocketFlags socketFlags)
at System.Net.Sock ets.NetworkStre am.Write(Byte[] buffer, Int32
offset, Int32 size)

Sep 21 '07 #1
2 6825
>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.Htt pUnhandledExcep tion' was thrown.
at System.Web.UI.P age.HandleError (Exception e)
at System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
at System.Web.UI.P age.ProcessRequ est(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
at System.Web.UI.P age.ProcessRequ est()
at System.Web.UI.P age.ProcessRequ estWithNoAssert (HttpContext
context)
at System.Web.UI.P age.ProcessRequ est(HttpContext context)
at ASP.coursecert_ presenter_main_ aspx.ProcessReq uest(HttpContex t
context)
at
System.Web.Http Application.Cal lHandlerExecuti onStep.System.W eb.HttpApp
lication.IExecu tionStep.Execut e()
at System.Web.Http Application.Exe cuteStep(IExecu tionStep step,
Boolean& completedSynchr onously)
INNER EXCEPTION:
Failure sending mail.
at System.Net.Mail .SmtpClient.Sen d(MailMessage message)
at coursecert.util ity.SendEmail(O bject from_email, Object
from_name, Object to_email, Object email_subject, Object
email_message)
at coursecert.util ity.SendAMail(S tring email_subject, String
email_message, Int32 cert_tracking_i d, String email_to)
at ASP.coursecert_ presenter_main_ aspx.SendMail(I nt32 message_ind)
at
ASP.coursecert_ presenter_main_ aspx.btnSendtoP RODUCTION_click (Object
sender, EventArgs e)
at System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e)
at System.Web.UI.W ebControls.Butt on.RaisePostBac kEvent(String
eventArgument)
at
System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.R
aisePostBackEve nt(String
eventArgument)
at System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument)
at System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection
postData)
at System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean
includeStagesAf terAsyncPoint)
INNER EXCEPTION:
Unable to write data to the transport connection: An existing
connection was forcibly closed by the remote host.
at System.Net.Sock ets.NetworkStre am.Write(Byte[] buffer, Int32
offset, Int32 size)
at System.Net.Pool edStream.Write( Byte[] buffer, Int32 offset, Int32
size)
at System.Net.Mail .SmtpConnection .Flush()
at System.Net.Mail .CheckCommand.S end(SmtpConnect ion conn, String&
response)
at System.Net.Mail .MailCommand.Se nd(SmtpConnecti on conn, Byte[]
command, String from)
at System.Net.Mail .SmtpTransport. SendMail(MailAd dress sender,
MailAddressColl ection recipients, String deliveryNotify,
SmtpFailedRecip ientException& exception)
at System.Net.Mail .SmtpClient.Sen d(MailMessage message)
INNER EXCEPTION:
An existing connection was forcibly closed by the remote host
at System.Net.Sock ets.Socket.Send (Byte[] buffer, Int32 offset,
Int32 size, SocketFlags socketFlags)
at System.Net.Sock ets.NetworkStre am.Write(Byte[] buffer, Int32
offset, Int32 size)

Sep 21 '07 #2
On Sep 21, 11:24 am, David R. Longnecker
<dlongnec...@co mmunity.nospamw rote:
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.tiredstude nt.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.Htt pUnhandledExcep tion' was thrown.
at System.Web.UI.P age.HandleError (Exception e)
at System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
at System.Web.UI.P age.ProcessRequ est(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
at System.Web.UI.P age.ProcessRequ est()
at System.Web.UI.P age.ProcessRequ estWithNoAssert (HttpContext
context)
at System.Web.UI.P age.ProcessRequ est(HttpContext context)
at ASP.coursecert_ presenter_main_ aspx.ProcessReq uest(HttpContex t
context)
at
System.Web.Http Application.Cal lHandlerExecuti onStep.System.W eb.HttpApp
lication.IExecu tionStep.Execut e()
at System.Web.Http Application.Exe cuteStep(IExecu tionStep step,
Boolean& completedSynchr onously)
INNER EXCEPTION:
Failure sending mail.
at System.Net.Mail .SmtpClient.Sen d(MailMessage message)
at coursecert.util ity.SendEmail(O bject from_email, Object
from_name, Object to_email, Object email_subject, Object
email_message)
at coursecert.util ity.SendAMail(S tring email_subject, String
email_message, Int32 cert_tracking_i d, String email_to)
at ASP.coursecert_ presenter_main_ aspx.SendMail(I nt32 message_ind)
at
ASP.coursecert_ presenter_main_ aspx.btnSendtoP RODUCTION_click (Object
sender, EventArgs e)
at System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e)
at System.Web.UI.W ebControls.Butt on.RaisePostBac kEvent(String
eventArgument)
at
System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.R
aisePostBackEve nt(String
eventArgument)
at System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument)
at System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection
postData)
at System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean
includeStagesAf terAsyncPoint)
INNER EXCEPTION:
Unable to write data to the transport connection: An existing
connection was forcibly closed by the remote host.
at System.Net.Sock ets.NetworkStre am.Write(Byte[] buffer, Int32
offset, Int32 size)
at System.Net.Pool edStream.Write( Byte[] buffer, Int32 offset, Int32
size)
at System.Net.Mail .SmtpConnection .Flush()
at System.Net.Mail .CheckCommand.S end(SmtpConnect ion conn, String&
response)
at System.Net.Mail .MailCommand.Se nd(SmtpConnecti on conn, Byte[]
command, String from)
at System.Net.Mail .SmtpTransport. SendMail(MailAd dress sender,
MailAddressColl ection recipients, String deliveryNotify,
SmtpFailedRecip ientException& exception)
at System.Net.Mail .SmtpClient.Sen d(MailMessage message)
INNER EXCEPTION:
An existing connection was forcibly closed by the remote host
at System.Net.Sock ets.Socket.Send (Byte[] buffer, Int32 offset,
Int32 size, SocketFlags socketFlags)
at System.Net.Sock ets.NetworkStre am.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.Configur ation.Configura tionManager.App Settings("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(Tri m(txtFromEmail. Text),
Trim(txtFromEma il.Text))
mail.To.Add(Tri m(txtToEmail.Te xt))
mail.Subject = txtSubject.Text
mail.Body = txtMessage.Text

smtp.Send(mail)

lblAlert.Text = "<font color =""green"">Emai l 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 document; your archive; re: unknow; re: questions; report; is that your account?; re: protected...
2
3272
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
57663
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 System.Net.Mail.SmtpClient.Send(String from, String
2
10140
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 is part of the problem but I don't know the solution and I have to be able to test sending email...
3
1983
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
1706
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
3466
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
4691
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
6143
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
9466
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9202
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8202
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4567
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4823
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3278
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
2
2741
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2191
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.