我使用java.security(使用Java 8(文件在我的Play Web服务器(2.5.x + Scala(上禁用了TLS版本,如下所示:
jdk.tls.disabledAlgorithms=SSLv3, TLSv1, RC4, MD5withRSA, DH keySize < 768,
EC keySize < 224, 3DES_EDE_CBC
通过此更改 (TLSv1(,我无法向 smtp.gmail.com:465 发送电子邮件。我正在使用游戏邮件版本 5.0.0。application.conf 文件中的设置:
host = smtp.gmail.com
port = 465
ssl = yes
我收到以下错误:
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2055)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:697)
at javax.mail.Service.connect(Service.java:386)
at javax.mail.Service.connect(Service.java:245)
at javax.mail.Service.connect(Service.java:194)
at javax.mail.Transport.send0(Transport.java:253)
at javax.mail.Transport.send(Transport.java:124)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1411)
at org.apache.commons.mail.Email.send(Email.java:1448)
at play.api.libs.mailer.SMTPMailer$$anon$2.send(MailerPlugin.scala:100)
Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
at sun.security.ssl.Handshaker.activate(Handshaker.java:503)
at sun.security.ssl.SSLSocketImpl.kickstartHandshake(SSLSocketImpl.java:1482)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1351)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:543)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:348)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:215)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2019)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:697)
问题已解决。参考: https://github.com/playframework/play-mailer/issues/150
简而言之:通过系统属性配置 SSL 协议。
这看起来像预期的行为。您收到协议已禁用的异常。你期望什么行为?