Hi,
Since you are asking how to send email, and it can't be sent with System.Net.Mail (because of the SSL issue), one option is to use aspNetEmail (something I wrote -- so this is partially a shameless plug). I'm not aware of any open source email component that can do this, with the SSL connection required.
Here is some code (just tested, and it works).
EmailMessage m = new EmailMessage();
m.LogPath = "c:\\email.log";
m.Logging = true;
m.Server = "smtpout.secureserver.net";
m.Port = 465;
m.TimeOut = 10000;
m.Username = "[email protected]";
m.Password = "abc123";
m.From ="[email protected]";
m.To = "[email protected]";
m.Subject = "subject here";
m.Body = "my body";
AdvancedIntellect.Ssl.SslSocket ssl = new AdvancedIntellect.Ssl.SslSocket();
//load the SSL socket, but tell it to connect *before* the 220 Welcome response
m.LoadSslSocket( ssl, true );
m.Send();
Console.WriteLine("Sent email");
If you want to try aspNetEmail, feel free to download the latest build update from
link text
You will also need a free eval license, which you can get from:
link text
If you have any other questions, feel free to ping me offline.
Cheers!
Dave
(more info added during later edit)
I couldn't find the orignal doc on MSDN that I was thinking of (it's been a few years). But here is a MSDN blog post from Dan Bagley.
http://blogs.msdn.com/webdav_101/archive/2008/06/02/system-net-mail-with-ssl-to-authenticate-against-port-465.aspx
System.Net.Mail with SSL to authenticate against port 465
Sending mail using System.Net.Mail with SSL will fail:
System.Net.NetworkCredential aCred = new System.Net.NetworkCredential("myacct", "mypassword");
SmtpClient smtp = new SmtpClient("smtp.mail.myserver.com", 465);
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Credentials = aCred;
System.Net.Mail only supports “Explicit SSL”.
Explicit SSL
System.Net.Mail only supports “Explicit SSL”. Explicit SSL starts as unencrypted on port 25, then issues a STARTDLS and switches to an Encrypted connection. See RFC 2228.
Explicit SLL would go something like: Connect on 25 -> StartTLS (starts to encrypt) -> authenticate -> send data
If the SMTP server expects SSL/TLS connection right from the start then this will not work.
Implicit SSL
There is no way to use Implicit SSL (SMTPS) with System.Net.Mail. Implicit SSL would have the entire connection is wrapped in an SSL layer. A specific port would be used (port 465 is common). There is no formal RFC covering Implicit SSL.
Implicit SLL would go something like: Start SSL (start encryption) -> Connect -> Authenticate -> send data
This is not considered a bug, it’s a feature request. There are two types of SSL authentication for SMTP, and we only support one (by design) – Explicit SSL.