473,721 Members | 2,220 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 6824
>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
3271
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
57660
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
3462
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
4689
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
6141
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
8840
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8730
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9215
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...
1
9131
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9064
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
5981
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4484
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
4753
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3189
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

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.