# springboot-sendMail **Repository Path**: cainiaojin/springboot-sendMail ## Basic Information - **Project Name**: springboot-sendMail - **Description**: springboot发送邮件功能 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-12-26 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # springboot-sendMail #### 介绍 springboot发送邮件功能 #### 集成教程 1. 引入发送邮件依赖 org.springframework.boot spring-boot-starter-mail 2. 在application.properties中配置相关的变量 spring.mail.default-encoding=utf-8 # 设置邮箱主机 spring.mail.host=smtp.qq.com # 设置用户名 spring.mail.username=xxxx.com # 设置密码,该处的密码是QQ邮箱开启SMTP的授权码而非QQ密码 spring.mail.password=xxxx # 设置是否需要认证,如果为true,那么用户名和密码就必须的, # 如果设置false,可以不设置用户名和密码,当然也得看你的对接的平台是否支持无密码进行访问的。 spring.mail.properties.mail.smtp.auth=true # STARTTLS[1] 是对纯文本通信协议的扩展。它提供一种方式将纯文本连接升级为加密连接(TLS或SSL),而不是另外使用一个端口作加密通信。 spring.mail.properties.mail.smtp.starttls.enable=true spring.mail.properties.mail.smtp.starttls.required=true mail.from=${spring.mail.username} mail.to=xxxx@qq.com 3. 在对应接口出注入变量 @Value("${mail.from}") private String from; 4. 进行相关代码的实现 参照相关实现类MailServiceImpl #### 码云特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)