By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,635 Members | 2,174 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,635 IT Pros & Developers. It's quick & easy.

SMTP failure

P: n/a
Hi
I am using the following code to send an email from within my program:-

MailMessage theMailMessage = new MailMessage("fr**@email.com", "to@email.com");
theMailMessage.Body = "body email message here";
theMailMessage.Attachments.Add(new Attachment("pathToEmailAttachment"));
theMailMessage.Subject = "Subject here";

SmtpClient theClient = new SmtpClient("IP.Address.Of.Smtp");
theClient.UseDefaultCredentials = false;
System.Net.NetworkCredential theCredential = new System.Net.NetworkCredential("us**@name.com", "password");
theClient.Credentials = theCredential;
theClient.Send(theMailMessage);

however I keep getting the following error:-

System.Net.Mail.SmtpException: Failure sending mail. ---System.Net.WebException: Unable to connect to the remote server ---System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Bool ean 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(Strin g 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 SubsUtilGeneric.SubsUtilities.AdminEmail(String PubCode, String eSubject, String eBody) in C:\WARC\VB.Net\SubsUtilGeneric\SubsUtilities.vb:li ne 1799

Any ideas please.?

Chubbly
Jan 19 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
2/8/2006
Smarter Email/Smtp setup with DotNet Configuration Sections (1.1 and 2.0)

http://sholliday.spaces.live.com/blog/

If you go there, you can download the code, and experiment with the different authentication modes.
...........

"Chubbly Geezer" <ch************@newsgroup.nospamwrote in message news:u3*************@TK2MSFTNGP04.phx.gbl...
Hi
I am using the following code to send an email from within my program:-

MailMessage theMailMessage = new MailMessage("fr**@email.com", "to@email.com");
theMailMessage.Body = "body email message here";
theMailMessage.Attachments.Add(new Attachment("pathToEmailAttachment"));
theMailMessage.Subject = "Subject here";

SmtpClient theClient = new SmtpClient("IP.Address.Of.Smtp");
theClient.UseDefaultCredentials = false;
System.Net.NetworkCredential theCredential = new System.Net.NetworkCredential("us**@name.com", "password");
theClient.Credentials = theCredential;
theClient.Send(theMailMessage);

however I keep getting the following error:-

System.Net.Mail.SmtpException: Failure sending mail. ---System.Net.WebException: Unable to connect to the remote server ---System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Bool ean 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(Strin g 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 SubsUtilGeneric.SubsUtilities.AdminEmail(String PubCode, String eSubject, String eBody) in C:\WARC\VB.Net\SubsUtilGeneric\SubsUtilities.vb:li ne 1799

Any ideas please.?

Chubbly
Jan 19 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.