c# - Anybody knows how to send SSL emails with System.Net.Mail through GoDaddy email servers -
i researched on , not find complete answer. many people, including myself, able send email through c# system.net.mail using port 25 or 587 , not using ssl. example, see here: https://stackoverflow.com/questions/1317809/sending-email-using-a-godaddy-account
others have solution using system.web.mail obsolete though: how can send emails through ssl smtp .net framework?
however, seems nobody has solution yet on how send emails using ssl port 465. have solution or @ least knows why ssl not working c#?
here code i'm using:
try { mailmessage mail = new mailmessage("sender@yourdomain.com", receivingemail, subject, body); string host = "smtpout.secureserver.net"; int port = 465; // it's 465 if using ssl, otherwise 25 or 587 smtpclient smtpserver = new smtpclient(host, port); smtpserver.credentials = new networkcredential("sender@yourdomain.com", "yourpassword"); smtpserver.enablessl = true; smtpserver.deliverymethod = smtpdeliverymethod.network; smtpserver.send(mail); } catch (exception ex) { // exception ... }
.net built-in mail class doesn't support needed ssl method (implicit ssl) , there's nothing this: reason explained here.
there exist third-party smtp client components both explicit , implicit ssl , have other cool functions. example, rebex.mail or our secureblackbox.
Comments
Post a Comment