發信功能遇到了無法連接SMTP的問題
由於該網站是使用phpmailer發信,丟出了以下錯誤訊息:
SMTP Error: Could not connect to SMTP host.
Mail error: SMTP Error: Could not connect to SMTP host.
原本的部分程式碼如下:
$mail->SMTPAuth = false;
$mail->SMTPSecure = 'ssl';
$mail->Host = "localhost";
$mail->Port = 25;
正常情況下,mail server一般都是用localhost,
但在hihosting似乎沒辦法,
後來靈機一動,
想到Hinet原本不是就有針對Hinet線路使用者提供SMTP server的服務嗎?
將程式碼改寫如下:
$mail->SMTPAuth = false;
$mail->SMTPSecure = 'ssl';
$mail->Host = "msa.hinet.net";
//$mail->Port = 25; 不指定使用25 port,因此註解掉
將host改用msa.hinet.net就可以正常發信囉!
3 則留言:
是否可以提供完整的設定呢?例如 username 的部分是要填寫什麼?是 email 還是 HiHosting 給的帳號?
不好意思這麼晚才看到您的留言
基本上如果$mail->Host = "msa.hinet.net";
在這裡host設定為msa.hinet.net的話
就不需要設定username及password了
The Most Successful Sites for Crypto, Casino & Poker - Goyang
Goyang Casino & Poker is one of the most famous and well goyangfc known kadangpintar crypto gambling sites, gri-go.com founded in 2012. https://jancasino.com/review/merit-casino/ They are popular bsjeon because of their great
張貼留言