6262import com .sun .mail .smtp .SMTPMessage ;
6363import com .sun .mail .smtp .SMTPSSLTransport ;
6464import com .sun .mail .smtp .SMTPTransport ;
65+ import org .apache .commons .lang3 .StringUtils ;
6566
6667@ Component
6768public class QuotaAlertManagerImpl extends ManagerBase implements QuotaAlertManager {
@@ -114,8 +115,9 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
114115 String smtpUsername = configs .get (QuotaConfig .QuotaSmtpUser .key ());
115116 String smtpPassword = configs .get (QuotaConfig .QuotaSmtpPassword .key ());
116117 String emailSender = configs .get (QuotaConfig .QuotaSmtpSender .key ());
118+ String smtpEnabledSecurityProtocols = configs .get (QuotaConfig .QuotaSmtpEnabledSecurityProtocols .key ());
117119 _lockAccountEnforcement = "true" .equalsIgnoreCase (configs .get (QuotaConfig .QuotaEnableEnforcement .key ()));
118- _emailQuotaAlert = new EmailQuotaAlert (smtpHost , smtpPort , useAuth , smtpUsername , smtpPassword , emailSender , _smtpDebug );
120+ _emailQuotaAlert = new EmailQuotaAlert (smtpHost , smtpPort , useAuth , smtpUsername , smtpPassword , emailSender , smtpEnabledSecurityProtocols , _smtpDebug );
119121
120122 return true ;
121123 }
@@ -341,7 +343,7 @@ static class EmailQuotaAlert {
341343 private final String _smtpPassword ;
342344 private final String _emailSender ;
343345
344- public EmailQuotaAlert (String smtpHost , int smtpPort , boolean smtpUseAuth , final String smtpUsername , final String smtpPassword , String emailSender , boolean smtpDebug ) {
346+ public EmailQuotaAlert (String smtpHost , int smtpPort , boolean smtpUseAuth , final String smtpUsername , final String smtpPassword , String emailSender , String smtpEnabledSecurityProtocols , boolean smtpDebug ) {
345347 _smtpHost = smtpHost ;
346348 _smtpPort = smtpPort ;
347349 _smtpUseAuth = smtpUseAuth ;
@@ -365,6 +367,10 @@ public EmailQuotaAlert(String smtpHost, int smtpPort, boolean smtpUseAuth, final
365367 smtpProps .put ("mail.smtps.user" , smtpUsername );
366368 }
367369
370+ if (StringUtils .isNotBlank (smtpEnabledSecurityProtocols )) {
371+ smtpProps .put ("mail.smtp.ssl.protocols" , smtpEnabledSecurityProtocols );
372+ }
373+
368374 if (!Strings .isNullOrEmpty (smtpUsername ) && !Strings .isNullOrEmpty (smtpPassword )) {
369375 _smtpSession = Session .getInstance (smtpProps , new Authenticator () {
370376 @ Override
0 commit comments