SmtpClient SSL issue.

N

Nick Z.

I am trying to connect to my SMTP server using the SmtpClient class.
For some reason its refusing to work. Here is the code and the error I get.

-----------------------------------------------------------

The code (I changed the server, user, and pass for obvious reasons):

SmtpClient client = new SmtpClient("mail.server.com");
client.Credentials = new NetworkCredential("user", "pass");

//I also tried the following instead of the previous line
//client.Credentials = new NetworkCredential("user", "pass",
"certificateDomain.com");

client.EnableSsl = true;
client.SendAsync("(e-mail address removed)", "(e-mail address removed)", "subject",
"body", null);

And here is the exception thrown:

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.EndConnect(IAsyncResult asyncResult)
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.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.End(IAsyncResult
result)
at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncResult result)
--- End of inner exception stack trace ---

------------------------------------------------------------

When I set up a mail account in mozilla the server works, but when
sending email, mozilla asks if I want to accept the certificate from the
server since it has a different domain. Is that the problem?

Thanks,
Nick Z.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top