fix:邮件设置开启TLS时,发送邮件失败
This commit is contained in:
parent
2da24153a4
commit
3f978b505c
|
@ -27,11 +27,12 @@ public class MailService {
|
||||||
javaMailSender.setDefaultEncoding("UTF-8");
|
javaMailSender.setDefaultEncoding("UTF-8");
|
||||||
javaMailSender.setProtocol("smtp");
|
javaMailSender.setProtocol("smtp");
|
||||||
props.put("mail.smtp.auth", "true");
|
props.put("mail.smtp.auth", "true");
|
||||||
|
String smtpHost = "";
|
||||||
for (SystemParameter p : paramList) {
|
for (SystemParameter p : paramList) {
|
||||||
switch (p.getParamKey()) {
|
switch (p.getParamKey()) {
|
||||||
case "smtp.host":
|
case "smtp.host":
|
||||||
javaMailSender.setHost(p.getParamValue());
|
javaMailSender.setHost(p.getParamValue());
|
||||||
|
smtpHost = p.getParamValue();
|
||||||
break;
|
break;
|
||||||
case "smtp.port":
|
case "smtp.port":
|
||||||
javaMailSender.setPort(Integer.parseInt(p.getParamValue()));
|
javaMailSender.setPort(Integer.parseInt(p.getParamValue()));
|
||||||
|
@ -52,6 +53,7 @@ public class MailService {
|
||||||
String result = BooleanUtils.toString(BooleanUtils.toBoolean(p.getParamValue()), "true", "false");
|
String result = BooleanUtils.toString(BooleanUtils.toBoolean(p.getParamValue()), "true", "false");
|
||||||
props.put("mail.smtp.starttls.enable", result);
|
props.put("mail.smtp.starttls.enable", result);
|
||||||
props.put("mail.smtp.starttls.required", result);
|
props.put("mail.smtp.starttls.required", result);
|
||||||
|
props.put("mail.smtp.ssl.trust", smtpHost);
|
||||||
break;
|
break;
|
||||||
/* case "smtp.anon":
|
/* case "smtp.anon":
|
||||||
boolean isAnon = BooleanUtils.toBoolean(p.getParamValue());
|
boolean isAnon = BooleanUtils.toBoolean(p.getParamValue());
|
||||||
|
|
Loading…
Reference in New Issue