Skip to content

DavidLei08/BlogMail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

在这里插入图片描述

BlogMail

基于spring-mail/thymeleaf

  • 支持文本邮件
  • 支持html模板邮件
  • 支持cc发送
  • 支持文件上传
  • 支持自定义邮箱配置

核心依赖

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-mail</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-thymeleaf</artifactId>
		</dependency>

基础配置

# 邮箱配置
spring:
  mail:
    host: smtp.163.com
    port:
    username: [email protected]
    password: *********
    protocol: smtp
    default-encoding: utf-8
    test-connection: true

核心类 - MailContentBuilder

    /**
     * 内容
     */
    private String content;

    /**
     * 接收者
     */
    private String to;

    /**
     * 发送者
     */
    private String from;

    /**
     * 主题
     */
    private String subject;

    /**
     * cc
     */
    private String[] cc;

    /**
     * 链接文件
     */
    private Map<String, File> linkFiles;


    /**
     * 是否类型为html
     */
    private boolean isHtml = false;

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages