首先要開啓QQ郵箱的smtp服務,默認是關閉的。java
登陸QQ郵箱,點「設置」 - 「賬戶」。git
找到「POP3/SMTP服務」和「IMAP/SMTP服務」項,點「開啓」。github
開啓以後,點擊「生成受權碼」。這個受權碼將做爲郵箱的身份認證密碼。spring
而後到系統後臺,在「系統管理」 - 「系統設置」 - 「郵件設置」中進行設置。sql
123456789@qq.com
,包括@qq.com
部分。設置好以後,必定要先點「保存」,而後再進行郵件發送測試。測試郵件不要寫「測試」、「123」之類的文字,以避免被認爲是垃圾郵件,被禁止發送。儘可能模仿一篇正式的郵件進行發送測試。服務器
若是配置不正確,無論哪一項的配置不正確,出現的錯誤信息基本都同樣的,大體爲:測試
org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 530 Error: A secure connection is requiered(such as ssl). More information at http://service.mail.qq.com/cgi-bin/help?id=28
若是出現下面的錯誤信息,則是由於使用了QQ郵箱的登陸密碼或者是密碼錯誤,應該使用上述的QQ郵箱受權碼。ui
org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.Au