POM依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
Java代码:
SimpleMailMessage message = new SimpleMailMessage();
message.setFrom(new InternetAddress(MimeUtility.encodeText("自定义昵称")+"<邮箱账号>").toString());
亲测可用,基于SpringBoot项目。
本文介绍了如何在SpringBoot项目中使用`spring-boot-starter-mail`依赖,实现Java代码中设置自定义发件人昵称和邮箱地址的方法,适合快速上手邮件发送配置。
1128

被折叠的 条评论
为什么被折叠?



