Commit ef4083c1 authored by Junling Bu's avatar Junling Bu
Browse files

Merge branch 'master' of https://github.com/linlinjava/litemall

parents 357fc451 207bf1e7
...@@ -11,6 +11,8 @@ import org.springframework.context.annotation.Configuration; ...@@ -11,6 +11,8 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl; import org.springframework.mail.javamail.JavaMailSenderImpl;
import java.util.Properties;
@Configuration @Configuration
@EnableConfigurationProperties(NotifyProperties.class) @EnableConfigurationProperties(NotifyProperties.class)
public class NotifyAutoConfiguration { public class NotifyAutoConfiguration {
...@@ -59,6 +61,17 @@ public class NotifyAutoConfiguration { ...@@ -59,6 +61,17 @@ public class NotifyAutoConfiguration {
mailSender.setHost(mailConfig.getHost()); mailSender.setHost(mailConfig.getHost());
mailSender.setUsername(mailConfig.getUsername()); mailSender.setUsername(mailConfig.getUsername());
mailSender.setPassword(mailConfig.getPassword()); mailSender.setPassword(mailConfig.getPassword());
mailSender.setPort(mailConfig.getPort());
Properties properties = new Properties();
properties.put("mail.smtp.auth",true);
properties.put("mail.smtp.timeout",5000);
properties.put("mail.smtp.starttls.enable",true);
properties.put("mail.smtp.socketFactory.fallback", "false");
//阿里云 必须加入配置 outlook配置又不需要 视情况而定.发送不成功多数是这里的配置问题
properties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
properties.put("mail.smtp.socketFactory.port", mailConfig.getPort());
properties.put("debug", true);
mailSender.setJavaMailProperties(properties);
return mailSender; return mailSender;
} }
......
...@@ -43,7 +43,7 @@ public class NotifyProperties { ...@@ -43,7 +43,7 @@ public class NotifyProperties {
private String password; private String password;
private String sendfrom; private String sendfrom;
private String sendto; private String sendto;
private Integer port;
public boolean isEnable() { public boolean isEnable() {
return enable; return enable;
} }
...@@ -91,6 +91,14 @@ public class NotifyProperties { ...@@ -91,6 +91,14 @@ public class NotifyProperties {
public void setSendto(String sendto) { public void setSendto(String sendto) {
this.sendto = sendto; this.sendto = sendto;
} }
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
} }
public static class Sms { public static class Sms {
......
...@@ -20,7 +20,7 @@ litemall: ...@@ -20,7 +20,7 @@ litemall:
password: XXXXXXXXXXXXX password: XXXXXXXXXXXXX
sendfrom: ex@ex.com.cn sendfrom: ex@ex.com.cn
sendto: ex@qq.com sendto: ex@qq.com
port: 465
# 短消息模版通知配置 # 短消息模版通知配置
# 短信息用于通知客户,例如发货短信通知,注意配置格式;template-name,template-templateId 请参考 NotifyType 枚举值 # 短信息用于通知客户,例如发货短信通知,注意配置格式;template-name,template-templateId 请参考 NotifyType 枚举值
sms: sms:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment