1.创建springboot项目,加入邮件maven依赖
<!-- mail start -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
2创建logback.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--<property name="logname" value="test"/>-->
<!--获取配置中的参数信息-->
<springProperty scope="context" name="logname" source="spring.application.name"/>
<springProperty scope="context" name="smtpHost" source="email.smtpHost"/>
<!--<springProperty scope="context" name="smtpPort" source="email.smtpPort"/>-->
<springProperty scope="context" name="to" source="email.to"/>
<springProperty scope="context" name="from" source="email.from"/>
<springProperty scope="context" name="username" source="email.username"/>
<springProperty scope="context" name="password" source="email.password"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"&