A secure connection is requiered(such as ssl). More information at http://service.mail.qq.com/cgi-bi

Posted 胖陀螺的春天

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了A secure connection is requiered(such as ssl). More information at http://service.mail.qq.com/cgi-bi相关的知识,希望对你有一定的参考价值。

javax.mail.AuthenticationFailedException: 530 Error: A secure connection is requiered(such as ssl). More information at http://service.mail.qq.com/cgi-bin/help?id=28

在java发送邮件的时候,出现了这个错误。

原因:QQ邮箱需要证书认证。

解决办法:

在原代码中加入下面代码

  1.  // 进行证书认证   
  2.                 MailSSLSocketFactory sf = new MailSSLSocketFactory();  
  3.                 sf.setTrustAllHosts(true);  
  4.                 properties.put("mail.smtp.ssl.enable", "true");  
  5.                 properties.put("mail.smtp.ssl.socketFactory", sf); 

 

以上是关于A secure connection is requiered(such as ssl). More information at http://service.mail.qq.com/cgi-bi的主要内容,如果未能解决你的问题,请参考以下文章

java运行jdk连接mysql出现了:Establishing SSL connection without server's identity verification is not re

Name Error Connection “:1.33“ is not allowed to own the service “x“ due to security policies in the

Client network socket disconnected before secure TLS connection was establishedView in Conso

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Te

无法下载图片 App Transport Security has blocked a cleartext HTTP (http://) resource load since it is inse

connect: Address is invalid on local machine or port is not valid on remote