SMTP Exception
-
Hi All, I keep getting an exception whenever i try to send an email message in an asp.net 2.0 application: I am using smtpclient & I have the MailMessage code and credentials setup correctly. **************************************************************************** Send failure: System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception stack trace --- at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at Default2.btnSubmit_Click(Object sender, EventArgs e) in c:\Documents and Settings\venki\My Documents\Visual Studio 2005\WebSites\RFQTest\Default2.aspx.cs:line 88Your mail has been sent ***************************************************************************** Could anyone help me is it any problem with my internet connection? or Do i need to change my code?? Thanks in Advance! :confused: :confused::confused:
-
Hi All, I keep getting an exception whenever i try to send an email message in an asp.net 2.0 application: I am using smtpclient & I have the MailMessage code and credentials setup correctly. **************************************************************************** Send failure: System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception stack trace --- at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at Default2.btnSubmit_Click(Object sender, EventArgs e) in c:\Documents and Settings\venki\My Documents\Visual Studio 2005\WebSites\RFQTest\Default2.aspx.cs:line 88Your mail has been sent ***************************************************************************** Could anyone help me is it any problem with my internet connection? or Do i need to change my code?? Thanks in Advance! :confused: :confused::confused:
Post the code you have written, that sends the email.
Steve Jowett ------------------------- Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
-
Post the code you have written, that sends the email.
Steve Jowett ------------------------- Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
Here is my Code::: protected void btnSubmit_Click(object sender, EventArgs e) { SmtpClient smtpClient = new SmtpClient(); MailMessage objMail = new MailMessage(); MailAddress objMail_Email = new MailAddress(lblEmail1.Text); objMail.From = objMail_Email; objMail.To.Add("toemail@.. .com"); objMail.Subject = "Form Submission"; objMail.Body = "" + "
Company : " + lblCompany1.Text + "
" + "
Address : " + lblAddress1.Text + "
" + "
Telephone :" + lblTelephone1.Text + "
" + "
Fax :" + lblFax1.Text + "
" + "
Email : " + lblEmail1.Text + "
" + "
Comments : " + lblComments1.Text + "
" + ""; objMail.Priority = MailPriority.High; smtpClient.Host = "mail.domain.com"; smtpClient.Credentials = new System.Net.NetworkCredential("username@domain.com", "password"); try { smtpClient.EnableSsl = false; smtpClient.Send(objMail); } catch (Exception exc) { Response.Write("Send failure: " + exc.ToString()); } Response.Write("Your mail has been sent"); } _____________
-
Hi All, I keep getting an exception whenever i try to send an email message in an asp.net 2.0 application: I am using smtpclient & I have the MailMessage code and credentials setup correctly. **************************************************************************** Send failure: System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception stack trace --- at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at Default2.btnSubmit_Click(Object sender, EventArgs e) in c:\Documents and Settings\venki\My Documents\Visual Studio 2005\WebSites\RFQTest\Default2.aspx.cs:line 88Your mail has been sent ***************************************************************************** Could anyone help me is it any problem with my internet connection? or Do i need to change my code?? Thanks in Advance! :confused: :confused::confused: