step 1:引入SpringBoot-email依赖
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-mail</artifactId>
</dependency>
step 2:配置email基本信息
spring.mail.host=smtp.orchome.com
spring.mail.username=*******@orchome.com
spring.mail.password=*********
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true
step 3:发送简单邮件
import org.dreams.forepart.Application;
import org.dreams.forepart.test.BaseSpringTest;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {Application.class},webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class EmailTest{
    @Autowired
    private JavaMailSender mailSender;
    @Test
    public void test() {
        SimpleMailMessage message = new SimpleMailMessage();
        message.setFrom("*******@orchome.com");
        message.setTo("*******@qq.com");
        message.setSubject("主题:简单邮件");
        message.setText("测试邮件内容");
        mailSender.send(message);
    }
}