//源生发送html 邮件
@Autowired
private JavaMailSender mailSender;
/**
* 发送html邮件
*
* @param to 发送的用户邮箱
* @param subject 标题
* @param content 正文
*/
@Override
public void sendHtmlMail(String to, String subject, String content) {
Properties props = new Properties();
props.put("mail.smtp.auth", auth);
props.put("mail.smtp.starttls.enable", enable);
props.put("mail.smtp.host", host);
props.put("mail.smtp.port", post);
final String userName = username;
final String passWord = password;
Session session = Session.getDefaultInstance(props,
new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(userName, pa
gmail 邮箱发送邮件 连接超时解决
最新推荐文章于 2023-06-06 22:34:10 发布