I have a problem sending e-mail messages through a SSL enabled mail server in ASPNET 2.0. I get a 'The operation has timed out' error when my program code try to send out an e-mail message using the SmtpClient object method Send
This is what I coded in my Web.config file for the mail settings section but there is no option for me to specify the mail server as SSL-enabled in this mail setting tags
<smtp from="xxxxxx" >
<network host="yyyy" port="999" userName="xxxxxx" password="pppppp" defaultCredentials="true" />
where xxxxxx = my e-mail address, yyyy = my SSL-enabled mail server name, 999= my mail server port number, pppppp = my e-mail password.
I am using NET 2.0 and Visual Studio 2008 in developing the mail application. How do I configure the mail settings for SSL-enabled mail server in my web config file and the C# coding to send out e-mail through a SSL-enabled mail server?
I hope someone could help me out. Thanks.
you might have just overlooked the EnableSsl property: http://www.systemnetmail.com/faq/4.5.aspx
I also tested with the SmtpClient object property EnableSsl set to true. It does not work. I still get the same error.
what error message?
The error message is
when my C# code call the SmtpClient Send method to the SSL-enabled mail server
How do I resolve this problem in my mailSettings elements in Web.config and my C# coding?
If you are supplying your own credentials, I suspect defaultCredentials="false" has to be set.
The melody of logic will always play out the truth. ~ Narumi Ayumu, Spiral
I have change the defaultCredentials to false in the mailSettings in the Web.config file and re-test my application code again. The same error message appear again...... 'Client does not have permission to submit.......'
I suggest you remove the configuration entries first, then just try the sample code in the systemnetmail.com link I posted above...By the way, does the server require you to send your account details (SMTP AUTH) before you can use it for sending emails?
Do you happen to have Norton or Symantec Anti-virus installed on your emailing computer? That error message appears to be highly related to the anti-virus scanner's manipulation logic.
I disable all Symantec Anti-virus activities and background programs, re-test my mail application again. Result still show the same problem....'The operation has timed out'
according to this there's a problem with using a mail server that uses SSL and requires client authentication at the same time.
Note: Due to what I believe is a bug in System.Net.Mail you *cannot* use SSL and Credentials (username/password) at the same time. I was never able to get that to work. I always got an exception from the remote mail server. I believe it has to do with the steps System.Net.Mail takes to initiate the SSL session and SMTP authentication.
JamesChew:Result still show the same problem....'The operation has timed out'
That versus "TLS not available due to temporary reason" does not seem like the same result to me. Now the situation has changed and the error message is different; you have a timeout issue. Are you able to connect to your SSL mail server from your computer?
Is there a connect or login method for smptclient object that I can use?
The staff in charge of the SSL-enabled mail server told me that I need to specifically perform a login authentication call using my stmp client in order for it to work.
Something that should look like.... smtpclient.login("my emailaddress", "password");
Currently, the System.Net.NetworkCredential method of the smtpclient is not able to work for this situation.
does your mail server support the older (non-formal) authentication styles like POP3-before-SMTP or IMAP-before-SMTP? which means you login to the server using POP3 or IMAP first, then the server notes your IP address, then after that you finally do your SMTP thing? if so you can do that...I'm sure there are third party, maybe even open source, POP3/IMAP libraries for .NET
Yes, you're right, a similar process like what you describe. I have to explicitly execute a login request first before I can send e-mail messages. Unfortunately, the current .NET smtpclient object is not able to perform this action for me. It's System.Net.NetworkCredential does not work in my situation, always giving me a 'time out' error.
I have found a 3rd party that can do that for me at www.safabyte.com