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

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

内容简介:纯粹为了记录,如果,恰巧与你遇到的是一个问题,可以通过以下方法解决你的问题,那么对于你我来说都是一件非常开心的事情。内网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

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

查看所有标签

猜你喜欢:

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

Discrete Mathematics and Its Applications

Discrete Mathematics and Its Applications

Kenneth H Rosen / McGraw-Hill Science/Engineering/Math / 2003-04-22 / USD 132.81

Discrete Mathematics and its Applications is a focused introduction to the primary themes in a discrete mathematics course, as introduced through extensive applications, expansive discussion, and deta......一起来看看 《Discrete Mathematics and Its Applications》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

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

在线图片转Base64编码工具

html转js在线工具
html转js在线工具

html转js在线工具