Skip to content

Commit

Permalink
fix: checking of trust server has been added;
Browse files Browse the repository at this point in the history
  • Loading branch information
smansoft committed Jul 12, 2022
1 parent c84784a commit 9123414
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions oxService/src/main/java/org/gluu/service/MailService.java
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,11 @@ public boolean sendMailSigned(SmtpConfiguration mailSmtpConfiguration, String fr

props.put("mail.smtp.socketFactory.class", "com.sun.mail.util.MailSSLSocketFactory");
props.put("mail.smtp.socketFactory.port", mailSmtpConfiguration.getPort());
props.put("mail.smtp.ssl.trust", mailSmtpConfiguration.getHost());
if (mailSmtpConfiguration.isServerTrust()) {
props.put("mail.smtp.ssl.trust", mailSmtpConfiguration.getHost());
}
props.put("mail.smtp.starttls.enable", true);
props.put("mail.smtp.starttls.required", true);
props.put("mail.smtp.starttls.required", true);
}
else if (smtpConnectProtect == SmtpConnectProtectionType.SslTls) {
props.put("mail.transport.protocol.rfc822", "smtps");
Expand All @@ -302,7 +304,9 @@ else if (smtpConnectProtect == SmtpConnectProtectionType.SslTls) {

props.put("mail.smtp.socketFactory.class", "com.sun.mail.util.MailSSLSocketFactory");
props.put("mail.smtp.socketFactory.port", mailSmtpConfiguration.getPort());
props.put("mail.smtp.ssl.trust", mailSmtpConfiguration.getHost());
if (mailSmtpConfiguration.isServerTrust()) {
props.put("mail.smtp.ssl.trust", mailSmtpConfiguration.getHost());
}
props.put("mail.smtp.ssl.enable", true);
}
else {
Expand Down

0 comments on commit 9123414

Please sign in to comment.