java 使用qq郵箱發送郵件報錯 port: 465, response: 550 錯誤

項目中使用到qq郵箱進行批量發送郵件的經常會報如下的錯誤:

javax.mail.MessagingException: Could not connect to SMTP host: smtp.qq.com, port: 465, response: 550
	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1960)
	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:642)
	at javax.mail.Service.connect(Service.java:295)
	at javax.mail.Service.connect(Service.java:176)

或者這樣的錯誤:

com.sun.mail.smtp.SMTPSendFailedException: 550 Mail content denied. 
http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=20022&&no=1000726

或者:

javax.mail.MessagingException: Could not connect to SMTP host: smtp.qq.com, port: 465, response: -1

大多是因爲一段時間內發送郵件太頻繁,導致被qq郵箱服務器拒絕連接了,使用定時任務或者多線程同時發送多封郵件經常會遇到這個問題
可嘗試以下連接的解決方案:
https://blog.csdn.net/baidu_34211956/article/details/83544631
或者等待一段時間後再發送
騰訊官方幫助文檔解釋如下:
https://service.mail.qq.com/cgi-bin/help?subtype=1&&id=20022&&no=1000722
在這裏插入圖片描述
https://service.mail.qq.com/cgi-bin/help?subtype=1&&id=20022&&no=1000726
在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章