caryyu 7 years ago
parent a793954c3e
commit 368260a4b3

@ -27,6 +27,9 @@ public class XxlJobAdminConfig implements InitializingBean{
@Value("${xxl.job.mail.port}")
private String mailPort;
@Value("${xxl.job.mail.ssl}")
private boolean mailSSL;
@Value("${xxl.job.mail.username}")
private String mailUsername;
@ -54,6 +57,10 @@ public class XxlJobAdminConfig implements InitializingBean{
return mailPort;
}
public boolean isMailSSL() {
return mailSSL;
}
public String getMailUsername() {
return mailUsername;
}

@ -35,8 +35,14 @@ public class MailUtil {
//email.setSSL(true);
email.setHostName(XxlJobAdminConfig.getAdminConfig().getMailHost());
if (XxlJobAdminConfig.getAdminConfig().isMailSSL()) {
email.setSslSmtpPort(XxlJobAdminConfig.getAdminConfig().getMailPort());
email.setSSLOnConnect(true);
} else {
email.setSmtpPort(Integer.valueOf(XxlJobAdminConfig.getAdminConfig().getMailPort()));
//email.setSslSmtpPort(port);
}
email.setAuthenticator(new DefaultAuthenticator(XxlJobAdminConfig.getAdminConfig().getMailUsername(), XxlJobAdminConfig.getAdminConfig().getMailPassword()));
email.setCharset(Charset.defaultCharset().name());

@ -7,6 +7,7 @@ xxl.job.db.password=root_pwd
### xxl-job email
xxl.job.mail.host=smtp.163.com
xxl.job.mail.port=25
xxl.job.mail.ssl=false
xxl.job.mail.username=ovono802302@163.com
xxl.job.mail.password=asdfzxcv
xxl.job.mail.sendNick=《任务调度平台XXL-JOB》

Loading…
Cancel
Save