很久没写JAVA程序了,原来用GMAIL发送邮件这么简单

编程入门 行业动态 更新时间:2024-10-27 07:24:20

很久没写JAVA程序了,原来用GMAIL发送邮件<a href=https://www.elefans.com/category/jswz/34/1761921.html style=这么简单"/>

很久没写JAVA程序了,原来用GMAIL发送邮件这么简单

写完代码,配置了GMAIL,死活发布出去,碰到了错误535-5.7.8 Username and Password not accepted.

首先先写代码,然后配置GMAIL.

第一写代码:

当你需要在 Spring Boot 中实现邮件通知时,你可以使用 Spring 的 JavaMailSender 来发送电子邮件。首先,确保你的 Spring Boot 项目已经配置好了邮件发送功能。下面是一个示例代码,演示如何在 Spring Boot 中发送邮件通知:

首先,在 `application.properties` 或 `application.yml` 文件中配置邮件服务的信息,例如:

```properties
# SMTP邮件发送配置
spring.mail.host=your-smtp-server
spring.mail.port=587
spring.mail.username=your-email@example
spring.mail.password=your-email-password
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true
```

YML属性文件

spring:
  mail:
    host: your-smtp-server
    port: 587
    use

更多推荐

很久没写JAVA程序了,原来用GMAIL发送邮件这么简单

本文发布于:2023-12-03 13:35:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1655930.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:这么简单   发送邮件   很久没   来用   程序

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!