[ZT] system. net. Mail with SSL to authenticate against port 465

Source: Internet
Author: User
Tags smtpclient

System. net. Mail sometimes fails to be sent under the ssl smtp server. After a while, it seems like this is the problem.

Sending mail using system. net. Mail with SSL will fail:

 

System. net.NetworkcredentialAcred =NewSystem. net.Networkcredential("Myacct","Mypassword");

SmtpclientSMTP =New Smtpclient("Smtp.mail.myserver.com", 465 );

SMTP. enablessl =True;

SMTP. usedefacrecredentials =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 wowould 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 wowould have the entire connection is wrapped in an SSL layer. A specific port wocould be used (Port 465 is common ). there is no formal RFC covering implicit SSL.

 

Implicit sll wowould 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.

Address: http://blogs.msdn.com/webdav_101/archive/2008/06/02/system-net-mail-with-ssl-to-authenticate-against-port-465.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.