springboot邮件发送与接收读取(真实使用)

发送邮件 

<dependency>
           <groupId>org.springframework.bootgroupId>
           <artifactId>spring-boot-starter-freemarkerartifactId>
        dependency>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-mailartifactId>
        dependency>
<dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-webartifactId>
        dependency>
spring:
  mail:
    port: 25
    username: ****
    password: ****
    protocol: smtp
    default-encoding: utf-8
    host: smtp.partner.outlook.cn
    properties:
            mail:
                smtp:
                    auth: true
                    starttls:
                        enable: true
                        required: true 

 

邮件模板

DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>消息通知title>
head>

<style type="text/css">
    table {
    
        font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
        width: 100%;
        border-collapse: collapse;
    }

    td, th {
    
        font-size: 1em;
        border: 1px solid #5B4A42;
        padding: 3px 7px 2px 7px;
    }

    th {
    
        font-size: 1.1em;
        text-align: center;
        padding-top: 5px;
        padding-bottom: 4px;
        background-color: #24A9E1;
        color: #ffffff;
    }
style>
<body>
  <img src="" alt="" style="display: inline-block;width: 0;height: 0"/>

<div>
    <h2>邮件消息通知h2>
    <table id="customers">
        <tr>
            <th>MessageCodeth>
            <th>MessageStatusth>
            <

你可能感兴趣的:(java,测试,ui)