email property modify

This commit is contained in:
geek 2017-06-30 12:29:54 +09:00
parent e232a6327c
commit 75b0773167

View File

@ -13,7 +13,6 @@ import java.util.Properties;
*/ */
@Configuration @Configuration
@ComponentScan(basePackages = "com.loafle.overflow") @ComponentScan(basePackages = "com.loafle.overflow")
//@ComponentScan(basePackages = "com.loafle.overflow", includeFilters = @ComponentScan.Filter(EmailAuth.class))
public class MailConfiguration { public class MailConfiguration {
@ -29,17 +28,6 @@ public class MailConfiguration {
@Value("${mail.protocol}") @Value("${mail.protocol}")
private String protocol; private String protocol;
@Value("${mail.properties.mail.smtp.auth}")
private boolean smtpAuth;
@Value("${mail.properties.mail.smtp.starttls.enable}")
private boolean ttlEnable;
@Value("${mail.transport.protocol}")
private String transProtocol;
@Value("${mail.smtps.ssl.checkserveridentity}")
private boolean checkserver;
@Value("${mail.smtps.ssl.trust}")
private String sslTrust;
@Bean @Bean
public JavaMailSenderImpl mailSender() { public JavaMailSenderImpl mailSender() {
JavaMailSenderImpl mailSender = new JavaMailSenderImpl(); JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
@ -58,15 +46,26 @@ public class MailConfiguration {
@Bean @Bean
public Properties getJavaMailProperties() { public Properties getJavaMailProperties() {
Properties javaMailProperties = new Properties(); Properties javaMailProperties = new Properties();
javaMailProperties.put("mail.smtp.starttls.enable", this.ttlEnable); javaMailProperties.put("mail.smtp.starttls.enable", true);
javaMailProperties.put("mail.smtp.auth", this.smtpAuth); javaMailProperties.put("mail.smtp.auth", true);
javaMailProperties.put("mail.transport.protocol", this.transProtocol); javaMailProperties.put("mail.transport.protocol", "smtp");
javaMailProperties.put("mail.debug", "true"); javaMailProperties.put("mail.debug", "true");
javaMailProperties.put("mail.smtps.ssl.checkserveridentity", this.checkserver); javaMailProperties.put("mail.smtps.ssl.checkserveridentity", true);
javaMailProperties.put("mail.smtps.ssl.trust", this.sslTrust); javaMailProperties.put("mail.smtps.ssl.trust", "*");
return javaMailProperties; return javaMailProperties;
} }
} }
//
// @Value("${mail.properties.mail.smtp.auth}")
// private boolean smtpAuth;
// @Value("${mail.properties.mail.smtp.starttls.enable}")
// private boolean ttlEnable;
// @Value("${mail.transport.protocol}")
// private String transProtocol;
// @Value("${mail.smtps.ssl.checkserveridentity}")
// private boolean checkserver;
// @Value("${mail.smtps.ssl.trust}")
// private String sslTrust;