如何设置 Camel 邮件组件使用TLS 1.3

mwngjboj  于 11个月前  发布在  Apache
关注(0)|答案(1)|浏览(125)

当尝试使用camel发送邮件时,我得到以下错误:

Stacktrace: javax.mail.MessagingException: Could not convert socket to TLS;
  nested exception is:
        javax.net.ssl.SSLHandshakeException: Received fatal alert: protocol_version

字符串
我正在测试邮件的路由:

from("direct:sendTestMail")
            .routeId("mail_test")
            .setHeader("subject", simple("test mail"))
            .to("smtp://xxxxx?"
                    + "port=587&"
                    + "mail.smtp.starttls.enable=true&"
                    + "username=xxxx&"
                    + "password=xxxx&"
                    + "from=xxxx&"
                    + "to=xxxx@gmail.com&" 
                    + "CC=xxxx@gmail.com")
            .log("Mail sent.");


我想这意味着我应该使用TLS 1.3而不是1.2。
我似乎找不到更改协议版本的方法,因为文档在这一点上似乎有点模糊,链接应该是有用的:
https://camel.apache.org/components/3.7.x/http-component.html#_setting_up_ssl_for_http_client
目前已损坏。
我知道在较新版本的camel中,TLS 1.3是默认版本,但是否可以在camel版本2.13.2中设置它?

w7t8yxp5

w7t8yxp51#

最后,我只需要在我的路线上再加一句话:

"mail.smtp.ssl.protocols=TLSv1.3&"

字符串
因此,有效的配置是:

from("direct:sendTestMail")
            .routeId("mail_test")
            .setHeader("subject", simple("test mail"))
            .to("smtp://xxxxx?"
                    + "port=587&"
                    + "mail.smtp.ssl.protocols=TLSv1.3&"
                    + "mail.smtp.starttls.enable=true&"
                    + "username=xxxx&"
                    + "password=xxxx&"
                    + "from=xxxx&"
                    + "to=xxxx@gmail.com&" 
                    + "CC=xxxx@gmail.com")
            .log("Mail sent.");

相关问题