项目中使用了JavaMail发送邮件,在本地测试无任何问题,但是上传到阿里云服务器上就报错:

com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.qq.com, 25; timeout -1; 

原因:阿里云出于安全考虑默认禁用25端口导致发邮件失败
解决办法:
配置文件中(根据自己的情况设置):

#JavaMailSender
spring.mail.host=smtp.qq.com
spring.mail.username=qq邮箱账号
#QQ??
spring.mail.password=授权码
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true
spring.mail.default-encoding=UTF-8
#指定端口        # SSL端口465、994,非SSL端口25
spring.mail.port=465
# 非SSL是 smtp
spring.mail.protocol=smtps
                    项目中使用了JavaMail发送邮件,在本地测试无任何问题,但是上传到阿里云服务器上就报错:com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.qq.com, 25; timeout -1; 原因:阿里云出于安全考虑默认禁用25端口导致发邮件失败解决办法:配置文件中(根据自己的情况设置):#JavaMailSenderspring.mail.host=smtp.qq.comspring.ma
				
原文参考:https://blog.csdn.net/a540891049/article/details/79385471 由于某些平台的linxu服务器为了安全起见 屏蔽了发送邮件的常用端口25、465、587 下面我用QQ邮箱举例子 用Linux命令 telnet smtp.qq.com 25 没有telnet可以安装telnet centos、u...
javax.mail.MessagingException: 500 Error: bad syntax at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:1363) at c...
发送邮件报错: org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 535 Error: authentication failed at org.springframewo...
发送邮件的时候首先报错ssl shakehands失败,后来网上搜到通过InstallCert.java来从服务器上下载证书,下载证书的时候报错如下:javax.net.ssl.SSLException: java.lang.UnsupportedOperationException at sun.security.ssl.Alerts.getSSLException(Alerts.java:2
3、测试即可 public static void main(String[] args) { MailUtils.sendMail("1667803373@qq.com", "你好,这是一封测试邮件,无需回复", "测试") ; System.out.println("已发送"); javax.mail.AuthenticationFailedException: 535 Error: authentication failed, system busy at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:932) 发送成功之后再控制台打印的内容1.先申请一个邮箱,然后开通pop3/smtp服务 这里我用的是网易的163邮箱 在开启POP3/SMTP服务的时候会让你输入一个授权码,这个授权码后面会用到. 2.代码的书写:@Test public void testJavaMail() throws Exception{ 关于项目报错:Error:Cannot build artifact ‘XXX:war exploded‘ because it is included into a circular dep 我欲逆天而行: 要是删错了怎么还原呢 迁移pg之后org.postgresql.util.PSQLException: ERROR: could not find left sibling of block 4594 in index.. chrome浏览器请求失败,Access to XMLHttpRequest at ‘http://localhost:8080/sockjs-node/info?t=........ 事务失效的几种原因 迁移pg之后org.postgresql.util.PSQLException: ERROR: could not find left sibling of block 4594 in index.. chrome浏览器请求失败,Access to XMLHttpRequest at ‘http://localhost:8080/sockjs-node/info?t=........ 事务失效的几种原因