Solved

Sending Email - Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

Posted on 2010-08-18
3
1,642 Views
Last Modified: 2013-11-30
I recently upgraded my computer at work and since then I cannot send email from applications running on my local computer.  This worked before the upgrade.  There is obviously some setting that needs to be tweaked but I don't know what it is.  Below is a very simple example of something that fails.  When it gets to the "theClient.Send(theEmailToSend)" it gets an exception and the message is: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

When i run this same code on a server as part of a Web application (with "theClient.Host" set to a proper IP address) it works fine.  I've always been able to change the host to "localhost" for my testing, but now it does not work.

Any ideas?

Thanks in advance.



System.Net.Mail.MailMessage theEmailToSend = new System.Net.Mail.MailMessage();
            System.Net.Mail.MailAddress theRecipient = new System.Net.Mail.MailAddress("TimAttaway@mchapusa.com", "Tim Attaway");
            theEmailToSend.To.Add(theRecipient);
            System.Net.Mail.MailAddress FromAddress = new System.Net.Mail.MailAddress("TimAttaway@mchapusa.com", "Tim Attaway");
            theEmailToSend.From = FromAddress;
            theEmailToSend.Body = "This is a simple email.";
            theEmailToSend.IsBodyHtml = false;
            theEmailToSend.Subject = "Email Test";
            System.Net.Mail.SmtpClient theClient = new System.Net.Mail.SmtpClient();
            theClient.Host = "localhost";
            theClient.Port = 25;
            theClient.Send(theEmailToSend);

Open in new window

0
Comment
Question by:TimAttaway
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
nycynik earned 500 total points
ID: 33466400
This could be because the server is not accepting your request.  

- Might be a firewall issue on your local computer, or between you and the server.  
- It might be that the server is not accepting mail from your computer, this is common to prevent spam sending you have to authenticate with the server.
0
 

Author Comment

by:TimAttaway
ID: 33466755
Actually the first problem was that SMTP service had never been installed on my local system.  I went to Control Panel -> Add/Remove Programs -> Add/Remove Windows Components -> IIS -> Details and clicked on SMTP Service to get that installed.  The next step was to get th email server to accept mail from my computer.  Thanks.
0
 

Author Closing Comment

by:TimAttaway
ID: 33466772
Provided me a direction but did not supply the whole solution.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SMTP reply command 1 35
Configure SPF check on IMSVA 2 113
Adjust the codes 3 63
Email accounts in Outlook owa 4 44
It is only natural that we all want our PCs to be in good working order, improved system performance, so that is exactly how programs are advertised to entice. They say things like:            •      PC crashes? Get registry cleaner to repair it!    …
There was an incident about the POP3 issue for the double read receipts and delivery receipts in Exchange 2013.  There was huge research been done and found solution for the duplicate mails. Especially when the user gets  duplicate mails.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question