您现在的位置是:亿华云 > IT科技
SpringBoot使用QQ邮箱发送邮件25端口被封了怎么办?
亿华云2025-10-09 15:29:54【IT科技】4人已围观
简介本文转载自微信公众号「Java时间屋」,作者Jack佳。转载本文请联系Java时间屋公众号。 前言 1.SpringBoot发送邮件配置: 结尾

前言
我上面有一篇发送邮箱的端口总结,总结邮箱的被封办发送使用方法,因为本地测试用的使用qq邮箱25没问题,公司的邮箱邮件邮箱非25端口使用也没问题,但是发送部署到自己的阿里云服务器上的时候一直报错,认证不通过,端口后来跟踪确认是被封办阿里云会封25端口,云服务器防止滥用,使用当然如果去解封25端口的邮箱邮件话也可以,本文是发送介绍不解封25端口怎样使用qq邮箱发送邮件。
1.SpringBoot发送邮件配置:
1.1添加依赖:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId> </dependency>1.2账号配置(不使用25端口改用465端口进行发送);
spring.mail.protocol=smtp ##比较重要的端口 spring.mail.port=465 spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.transport.protocol=smtp spring.mail.properties.mail.smtp.socketFactory.port=465 spring.mail.properties.mail.smtp.port=465 spring.mail.properties.mail.smtp.connectiontimeout=15000 spring.mail.properties.mail.smtp.socketFactory.fallback=false spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory spring.mail.host=smtp.qq.com #下面的配置qq是一样的不区分,但是被封办公司的邮箱账号大多是是没后缀的 spring.mail.username=xxxxx@qq.com mail.address=xxxxx@qq.com #邮箱的认证密码。免费信息发布网如果是qq和163的话是鉴权码,公司邮箱的话是密码 spring.mail.password=xxxxxxxxxx #编码类型 spring.mail.default-encoding=UTF-8结尾
上面就是我实战的qq邮箱不使用25端口使用465端口的配置实战,当时在自己的服务器上面搞了很长时间才搞定,也是自己的心得总结,希望能帮助到使用的朋友们
企商汇很赞哦!(97293)