c# - SMTP email message with SSL not working with GoDaddy email address in ASP.NET -


when try send stmp email in asp.net using ssl on new godaddy email address, not work. receive error message saying unable read data transport connection: net_io_connectionclosed.

here email settings server:

enter image description here

here's snippet web.config email server information:

<system.net>   <mailsettings>     <smtp from="no-reply@mysite.com" >       <network host="smtpout.secureserver.net" port="465" username="no-reply@mysite.com" password="password123" enablessl="true" />     </smtp>   </mailsettings> </system.net> 

and here's c# code sends email.

mailmessage message = new mailmessage(); message.to.add(new mailaddress(to)); message.subject = "message " + inputmodel.name; message.body = body; message.isbodyhtml = true;  using (var smtp = new smtpclient()) {     smtp.send(message); } 

ports 80, 3535, , 25 work fine without ssl, none of 4 work with ssl. tried port 587 ssl, , after quite long time times out.

how can these emails send using ssl?

much in this older question, including description of problem - smtpclient supports "explicit ssl", , need "implicit ssl" talk ssl on port 465 directly.

a better , more modern approach options discussed there, use maintained library has implicit ssl support. mailkit way go this.

alternatively, consider using third-party email relay service, such sendgrid, mandrill, mailgun, , others. doing improve odds of users receive mail in inbox rather spam/junk folder.


Comments