Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error sending email

Status
Not open for further replies.

onechuck

IS-IT--Management
Feb 14, 2006
79
US
This is the code I use to send my form via email:

protected void sendMail(string strFrom, string strBody)
{
//create the mail message
MailMessage mail = new MailMessage();

//set the addresses
mail.From = new MailAddress(strFrom);
mail.To.Add("myEmail@myDomain.com");

//set the content
mail.Subject = txtSubject.Text;
mail.Body = strBody;
mail.IsBodyHtml = false;

//send the message
SmtpClient smtp = new SmtpClient("noAuth.myDomain.com");
smtp.Send(mail);
}

And this is the error message I received:

Server Error in '/home' Application.
--------------------------------------------------------------------------------

Unable to read data from the transport connection: net_io_connectionclosed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed.

Source Error:

Line 84: //send the message
Line 85: SmtpClient smtp = new SmtpClient("noAuth.myDomain.com");
Line 86: smtp.Send(mail);
Line 87: }
Line 88: }

Source File: e:\ Line: 86
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top