com.jiangkedev.email.EmailConfig Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of service-base Show documentation
Show all versions of service-base Show documentation
a common utils for spring boot project
The newest version!
package com.jiangkedev.email;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import java.util.Properties;
/**
* author:bazz jiang
* date:Create in 2018-07-27
* email:[email protected]
*/
@Configuration
public class EmailConfig {
@Bean
public JavaMailSender sohuMailSender(){
//需要去搜狐邮箱开启服务
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setHost("smtp.sohu.com");
mailSender.setPort(25);
mailSender.setUsername("[email protected]");
mailSender.setPassword("");
Properties props = mailSender.getJavaMailProperties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.debug", "true");
return mailSender;
}
}