SpringBoot开发案例之邮件发不出去了

栏目: Java · 发布时间: 5年前

内容简介:纯粹为了记录,如果,恰巧与你遇到的是一个问题,可以通过以下方法解决你的问题,那么对于你我来说都是一件非常开心的事情。内网IT部门给了一个邮箱账号,不需要使用密码就可以在内网发送邮件,当然只能发内部企业邮件,企鹅、163之类的是不可以的。

SpringBoot开发案例之邮件发不出去了

前言

纯粹为了记录,如果,恰巧与你遇到的是一个问题,可以通过以下方法解决你的问题,那么对于你我来说都是一件非常开心的事情。

问题

内网IT部门给了一个邮箱账号,不需要使用密码就可以在内网发送邮件,当然只能发内部企业邮件,企鹅、163之类的是不可以的。

发送邮件用的 starter 版本如下,请对号入座:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-mail</artifactId>
    <version>1.5.10.RELEASE</version>
</dependency>

邮件配置:

spring.mail.host=smtp.52itstyle.com
spring.mail.username=admin@52itstyle.com
spring.mail.password=
# 既然不需要密码,设置为 false 即可
spring.mail.properties.mail.smtp.auth=flase
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true

报错:

Could not convert socket to TLS;

不能把socket解析为TLS,我们只需要把当前 smtp host 设为可信任即可。

# 这里设置信任
spring.mail.properties.mail.smtp.ssl.trust=smtp.52itstyle.com

继续报错:

535 5.7.3 Authentication unsuccessful

最终配置:

spring.mail.host=smtp.52itstyle.com
spring.mail.username=admin@52itstyle.com
# 内网发送把密码去掉就可以
#spring.mail.password=
spring.mail.properties.mail.smtp.auth=flase
spring.mail.properties.mail.smtp.ssl.trust=smtp.52itstyle.com
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Alone Together

Alone Together

Sherry Turkle / Basic Books / 2011-1-11 / USD 28.95

Consider Facebookit’s human contact, only easier to engage with and easier to avoid. Developing technology promises closeness. Sometimes it delivers, but much of our modern life leaves us less connect......一起来看看 《Alone Together》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试