記php升級到5.6及以上版本給phpmailer留的坑

沒想到居然還能在php底下掛一篇,哦哈哈哈哈。但是這篇基本不會有什麼要coding。

背景是發現https的網站上發郵件居然不管用了。報的最初錯誤是,無法連接到smtp服務器。

根據邏輯,先走telnet 和 證書驗證查詢,都沒毛病(這裏瞎舉例一下口令

"telnet smtp.xx.com 777" and “echo QUIT | openssl s_client -connect smtp.xx.com:777"

)。端口對應加密方式,也沒毛病ssl->465, tls->587,木有加密走25。但,就是發不出!

然後看到了下面這段話,老淚縱橫。

"Starting from version 5.6, PHP always verifies certificate if TLS is used. Since a self-signed certificate is used on the server, the certificate verification by PHP gets failed. Certificate used to protect mail server does not correspond with the greeting message of Mail Transport Agent."
Directly quoted from https://support.plesk.com/hc/en-us/articles/115003022854--Troubleshooting-WordPress-Website-with-PHPMailer-or-SMTP-extension-cannot-send-mail-Failed-to-connect-to-server-0-SMTP-connect-failed

然後想說EASY xxx插件比WP SMTP Mail(這個插件就提示多算個優點吧)那個插件好。好吧,這個好一點的插件的名字,我也沒記完整,總之有個EASY在裏面。

EASY畢竟本地密碼還有個加密選項,自我簽發證書的驗證有跳過選項。

最後的最後,提醒,其實郵件加密可以去wp-include/class-phpmailer.php裏面hard code。

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