You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by rainbows appintment <85...@qq.com.INVALID> on 2023/06/14 02:30:07 UTC
What is the default ssl version and can I change it?
I encountered a problem when using this. After the SMTP server turned off support for tls1.0 and tls1.1, it now only supports tls1.2 and higher versions, and mail cannot be sent. I would like to ask can this be specified as ssl version tls1.2?and I tried using Javamail to successfully specify it
Here is the error log
org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.sendgrid.net:465
at org.apache.commons.mail.Email.c(Email.java:1421)
at org.apache.commons.mail.Email.d(Email.java:1448)
at com.pax.pay.trans.receipt.a.a.a(AReceiptEmail.java:100)
at com.pax.pay.trans.receipt.a.b.a(ReceiptEmailTrans.java:50)
at com.pax.pay.trans.receipt.a.b.a(ReceiptEmailTrans.java:111)
at com.pax.pay.trans.action.ac$1.run(ActionSendEmail.java:158)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: smtp.sendgrid.net, port: 465;
nested exception is:
javax.net.ssl.SSLHandshakeException: Connection closed by peer
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
at javax.mail.Service.connect(Service.java:310)
at javax.mail.Service.connect(Service.java:169)
at javax.mail.Service.connect(Service.java:118)
at javax.mail.Transport.send0(Transport.java:188)
at javax.mail.Transport.send(Transport.java:118)
at org.apache.commons.mail.Email.c(Email.java:1411)
... 8 more
Caused by: javax.net.ssl.SSLHandshakeException: Connection closed by peer
at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
at com.android.org.conscrypt.SslWrapper.doHandshake(SslWrapper.java:375)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.startHandshake(ConscryptFileDescriptorSocket.java:217)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.waitForHandshake(ConscryptFileDescriptorSocket.java:468)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.getInputStream(ConscryptFileDescriptorSocket.java:431)
at com.sun.mail.smtp.SMTPTransport.initStreams(SMTPTransport.java:1449)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1366)
... 15 more
And Javamail can be sent in this way
props.put("mail.smtp.ssl.protocols", "TLSv1.2");
Re: What is the default ssl version and can I change it?
Posted by Shawn Heisey <ap...@elyograg.org>.
On 6/13/23 20:30, rainbows appintment wrote:
> I encountered a problem when using this. After the SMTP server turned off support for tls1.0 and tls1.1, it now only supports tls1.2 and higher versions, and mail cannot be sent. I would like to ask can this be specified as ssl version tls1.2?and I tried using Javamail to successfully specify it
What Java version are you running your program in? The very first Java
release that can do TLS 1.2 is Java 7u95.
Your question is missing a lot of vital information ... the version of
commons-mail you're using, the version of Java you're using, and exactly
how you are building the connection that is failing.
I have a program that uses jakarta-mail, which is very similar to
javamail. It is running in Java 11. It is able to connect to my mail
server without any problems ... a mail server that requires TLSv1.2 or
TLSv1.3. I have not specified any TLS parameters in my program at all.
Thanks,
Shawn
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org