473,396 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

SmtpClient SSL issue.

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("fr**@server1.com", "to@server2.com", "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(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.Mail.SmtpConnection.ConnectAndHandshake AsyncResult.End(IAsyncResult
result)
at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncR esult 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.
Nov 21 '05 #1
1 8235
I'm sorry it was a problem with my server. =(

Sorry for wasting your time,
Nick Z.
Nick Z. wrote:
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("fr**@server1.com", "to@server2.com", "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(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.Mail.SmtpConnection.ConnectAndHandshake AsyncResult.End(IAsyncResult
result)
at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncR esult 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.

Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: hazz | last post by:
smtpClient.Send(message) is causing me problems as per specifics in the trace below. Email is sent but not without this error typically upon sending the second email, but sometimes when running...
2
by: mazdotnet | last post by:
Hi everyone, I'm coverting some of our code here from the old way of sending mail in ..NET 1.1 to the new .NET 2.0. However, everytime I switch the code to the new method there is a delay of 1-2...
10
by: David Thole | last post by:
Hey all, I'm still very new at all this, but am going through the ASP.net 2.0 unleashed book, first chapter and trying to program my own little form emailer for fun. I tried following the code...
0
by: howardr101 | last post by:
Hi, Have hunted around on the groups and can't find anything, hence. I've tried this against 2 mail servers (mailtraq and hmailserver) and it occus with both. The problems seems to be that...
4
by: | last post by:
Hi all, We are using the Asp.Net SMTP Client to send email via our Exchange 2003 SP2 Server. When trying to send email to a local recipient I am getting the following error:- Server:...
7
by: Rob Dob | last post by:
The following code is giving me a timeout problem., no matter what I do I can't send a piece of mail using .net2.0 System.Net.Mail.SmtpClient via port 465 and using ssl, if however I try using...
8
by: Marty | last post by:
I'm having issues sending an email to an "@page.nextel.com" email address. I can send to any other email address fine, but when I try the page.nextel.com it gives me this error: ...
2
by: btcoder | last post by:
Hi, my jsp page uses sun.net.smtp.SmtpClient to send email. It worked fine until the hosted location was moved to another server. Now it generates the sun.net.smtp.SmtpProtocolException and the...
5
by: BigDave | last post by:
Hi, I'm having problems with SmtpClient. I have the following set in my web.config: <configuration> <system.net> <mailSettings> <smtp> <network host="mysmtp" port="25" userName="myuser"
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.