TimAttaway
asked on
Sending Email - Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
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(theEmailTo Send)" 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.
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);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Provided me a direction but did not supply the whole solution.
ASKER