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

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

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

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

查看所有标签

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

Host Your Web Site In The Cloud

Host Your Web Site In The Cloud

Jeff Barr / SitePoint / 2010-9-28 / USD 39.95

Host Your Web Site On The Cloud is the OFFICIAL step-by-step guide to this revolutionary approach to hosting and managing your websites and applications, authored by Amazon's very own Jeffrey Barr. "H......一起来看看 《Host Your Web Site In The Cloud》 这本书的介绍吧!

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

HTML 编码/解码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具