Is it possible to set the communication when sending email to TLS 1.2 only?

 
[Handling method]

If you are using 2018 Summer (tiffany) or later, you can set it by setting the SSL protocol below.

http://www.intra-mart.jp/document/library/iap/public/configuration/im_configuration_reference/texts/im_javamail/javamail-config/index.html#javamail-config_protocol
Add protocol to WEB-INF/conf/javamail-config/javamail-config.xml as follows:

<smtps enable="true" starttls="false">
  <protocols>
    <protocol>TLSv1.2</protocol>
  </protocols>
</smtps>


If you are using 2018 Spring (Skylark) or earlier, you can set it by setting the listener below.

It is possible by setting the listener below.
https://www.intra-mart.jp/document/library/iap/public/configuration/im_configuration_reference/texts/im_javamail/javamail-config/index.html#%E3%83%AA%E3%82%B9%E3%83%8A%E8%A8%AD%E5%AE%9A%0D%0A
Example
1. Add listener-class to WEB-INF/conf/javamail-config/javamail-config.xml as follows:

   <listener>
    <listener-class>jp.co.intra_mart.foundation.mail.javamail.listener.impl.HalfKanaTransrateListener</listener-class>
    <listener-class>jp.co.intra_mart.example.ExampleJavaMailListener</listener-class> <!-- added -->
  </listener>


2. Implement the listener.


package jp.co.intra_mart.example;

import java.util.Properties;

import javax.mail.Session;

import jp.co.intra_mart.foundation.mail.MailSenderException;
import jp.co.intra_mart.foundation.mail.javamail.listener.MailSendEvent;
import jp.co.intra_mart.foundation.mail.javamail.listener.MailSendListener;

public class ExampleJavaMailListener implements MailSendListener {
    @Override
    public int onSendMail(final MailSendEvent event) throws MailSenderException {
        final Session session = event.getSession();
        final Properties properties = session.getProperties();

        properties.put("mail.smtp.ssl.protocols", "TLSv1.2"); // TLS 1.2 is only used. If TLS 1.2 is unable to communicate, you will get an error. You can specify more than one by spaces, such as "TLSv1.1 TLSv1.2" (used sequentially from the left-most protocol. If the first is not available, the second protocol is used.)

        return MailSendListener.CONTINUE;
    }
}

-- Target --------------------------------------------------------------------
iAP/Accel Platform
--------------------------------------------------------------------------------




FAQID:681
Was this article helpful?
0 out of 0 found this helpful
Powered by Zendesk