From ca3a32717250e2c5f6467578b81f7b859061ef5b Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 24 Jun 2021 12:29:18 +0000 Subject: [PATCH] [Trunk | Admin Tools Library]: Added properties.put("mail.smtp.ssl.protocols", "TLSv1.2"); if(mailConfig.getHost().equals("smtp.gmail.com")) (only for dev). --- .../dnetlib/uoaadmintoolslibrary/emailSender/EmailSender.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/eu/dnetlib/uoaadmintoolslibrary/emailSender/EmailSender.java b/src/main/java/eu/dnetlib/uoaadmintoolslibrary/emailSender/EmailSender.java index 6d5e9a4..87d326b 100644 --- a/src/main/java/eu/dnetlib/uoaadmintoolslibrary/emailSender/EmailSender.java +++ b/src/main/java/eu/dnetlib/uoaadmintoolslibrary/emailSender/EmailSender.java @@ -30,6 +30,9 @@ public class EmailSender { properties.put("mail.smtp.port", mailConfig.getPort()); properties.put("mail.smtp.auth", mailConfig.getAuth()); //enable authentication properties.put("mail.smtp.starttls.enable", "true"); + if(mailConfig.getHost().equals("smtp.gmail.com")) { + properties.put("mail.smtp.ssl.protocols", "TLSv1.2"); + } logger.debug("Try to connect to mail sender with "+ mailConfig.getUsername()); Session session = Session.getInstance(properties, new javax.mail.Authenticator() {