springboot send qq mail

spring.mail.host=smtp.qq.com

spring.mail.port=465

spring.mail.username=970959041@qq.com

spring.mail.password=xfuupxjimcpfbbdf

spring.mail.properties.mail.smtp.ssl.enable=true

spring.mail.properties.mail.smtp.auth=true

#spring.mail.properties.mail.smtp.starttls.enable=false

#spring.mail.properties.mail.smtp.starttls.required=false

@Component

public class EmailSender {

@Autowired

private JavaMailSender emailSender;

public void sendEmailToRecepient() throws MessagingException {

MimeMessage mimeMessage = emailSender.createMimeMessage();

MimeMessageHelper message = new MimeMessageHelper(mimeMessage, true, "UTF-8");

message.setFrom("xxxx@qq.com");

message.setTo("yyyy@qq.com");

message.setSubject("this is a test");

message.setText("Good luck", true);

emailSender.send(mimeMessage);

}

}

相关推荐
qq_1851986931 分钟前
SpringBoot-五-AOT
java·spring boot·后端
王大大的刀37 分钟前
Spring AI 重试引起的 LLM 重复调用
java·人工智能
这个DBA有点耶1 小时前
多模数据库深度解读:从“多库拼装”到“一库多能”的架构演进
数据库·mysql·dba
晓晓_za8986681 小时前
Geo 优化服务 CI/CD 流水线搭建:源码自动构建、测试与灰度发布
运维·服务器·tcp/ip·spring·缓存·ci/cd
风流 少年1 小时前
hutool
java·服务器·开发语言
H_oRIZoN_1 小时前
Linux入门DAY27(文件IO(系统调用)详解|open/read/write/lseek)
java·linux·服务器
延凡科技1 小时前
从 “人管机器“ 到 “数据管人“:智慧矿山综合管控落地实践
java·后端·struts
程序员夏洛1 小时前
MySQL 默认的事务隔离级别是什么?为什么选择这个级别?
数据库·mysql
艺术留白2 小时前
MokaTest使用篇-SQL接口
数据库·sql
卓怡学长2 小时前
w180springboot基于Java的悠扬乐器管理
java·spring boot·mysql·spring·maven·intellij-idea