赞
踩
这一步根据个人风格就行,看需求公司用什么邮箱就去注册,后续需要用到相关API也是大同小异
<!--发送邮件-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
<version>2.1.5.RELEASE</version>
</dependency>
<!--
这里我用的是thymeleaf
用thymeleaf的小伙伴导入模板引擎jar包就行
-->
# MailProperties
spring.mail.host=smtp.sina.com
spring.mail.port=465
spring.mail.username=tgywatalive@sina.com
spring.mail.password= # 配置自己的即可
spring.mail.protocol=smtps
spring.mail.properties.mail.smtp.ssl.enable=true
package com.newcoder.community.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMailMessage
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。