Send Mail in C# 2005
-
HI, I got trouble of sending an email out from my application. An exception happened when from smtpclient.send object . Any suggestion? Thanks. Kyah
Could you give us some information on the exception? what type? what was the error message? Also, could you post some your code (the 10 o 15 lines where you send the email)? From what you say it's hard for us to know the problem.
Luis Alonso Ramos Intelectix Chihuahua, Mexico
Not much here: My CP Blog!
-
Could you give us some information on the exception? what type? what was the error message? Also, could you post some your code (the 10 o 15 lines where you send the email)? From what you say it's hard for us to know the problem.
Luis Alonso Ramos Intelectix Chihuahua, Mexico
Not much here: My CP Blog!
I just followed the sample code in the MSDN library for Visual Studio in 2005. The exception: System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: U able to connect to the remote server ---> System.Net.Sockets.SocketException: An est blished connection was aborted by the software in your host machine at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress s cketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s , Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncRes lt 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 imeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 tim out, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asy cCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDeleg te 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) ----------------- I just want to send a test to my network mail server not local machine. Thanks. Kyah
-
I just followed the sample code in the MSDN library for Visual Studio in 2005. The exception: System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: U able to connect to the remote server ---> System.Net.Sockets.SocketException: An est blished connection was aborted by the software in your host machine at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress s cketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s , Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncRes lt 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 imeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 tim out, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asy cCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDeleg te 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) ----------------- I just want to send a test to my network mail server not local machine. Thanks. Kyah
I haven't seen the code, but I would guess you are trying to use localhost as your SMTP server when the service has not been enabled. Could you post the code?
Luis Alonso Ramos Intelectix Chihuahua, Mexico
Not much here: My CP Blog!
-
I just followed the sample code in the MSDN library for Visual Studio in 2005. The exception: System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: U able to connect to the remote server ---> System.Net.Sockets.SocketException: An est blished connection was aborted by the software in your host machine at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress s cketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s , Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncRes lt 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 imeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 tim out, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asy cCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDeleg te 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) ----------------- I just want to send a test to my network mail server not local machine. Thanks. Kyah
I have run into this problem. In my case, our Virus software was preventing the mail from being sent. Our administrator had to allow mail coming from my machine for the vshost.exe process.