請益:如何使用 phpmailer 連線中華電信 msa.hinet.net smtp server ?

各位先知:
最近有個需求要使用 phpmailer 連線 hinet SMTP server , 但是無法連線成功
我家裡用 So-net , 連線發信是沒有問題的, 但是另外其他地方使用的是 hinet 就發生問題
php.ini 的 smtp host 也改了, 沒用!
打電話去中華電信客服問了, 設定也就這樣而已, 使用 msa.hinet.net 不需要另外驗證
是不是我缺了那些設定? 請前輩指點

我的程式碼如下:
$mail = new PHPMailer\PHPMailer\PHPMailer(true);
$mail->SMTPDebug = 2; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->CharSet = "big5";
$mail->Host = 'msa.hinet.net'; // Specify main and backup SMTP servers
$mail->Username = '123456789'; // SMTP username
$mail->Password = '*********'; // SMTP password
$mail->Port = 25; // TCP port to connect to
$mail->setFrom('myemail@msa.hinet.net', mb_convert_encoding("國際企業","big5","utf-8"));
$mail->addAddress('myemail@yahoo.com.tw', mb_convert_encoding('蔡小小',"big5","utf-8"));
$mail->addReplyTo('myemail@yahoo.com.tw', mb_convert_encoding("蔡小小","big5","utf-8"));
$mail->isHTML(true); // Set email format to HTML
$subject = ("信件寄送測試".date("Y-m-d H:i:s",time()+7*3600));
$mail->Subject = mb_convert_encoding($subject,"big5","utf-8");
$body = "薪資單";
$mail->Body = mb_convert_encoding($body,"big5","utf-8");
$mail->AltBody = mb_convert_encoding($body,"big5","utf-8");

if ($mail->send())
echo "信件寄送成功";

然後測試結果顯示:
2019-11-14 08:30:56 SERVER -> CLIENT: 220 msr14.hinet.net ESMTP Sendmail 8.15.2/8.15.2; Thu, 14 Nov 2019 16:30:55 +0800
2019-11-14 08:30:56 CLIENT -> SERVER: EHLO 220.132.xxx.xxx
2019-11-14 08:30:56 SERVER -> CLIENT: 250-msr14.hinet.net Hello 220-132-xxx-xxx.HINET-IP.hinet.net [220.132.xxx.xxx], pleased to meet you250-ENHANCEDSTATUSCODES250-PIPELINING250-8BITMIME250-SIZE 73400320250-ETRN250-AUTH LOGIN PLAIN250-STARTTLS250-DELIVERBY250 HELP
2019-11-14 08:30:56 CLIENT -> SERVER: STARTTLS
2019-11-14 08:30:56 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
SMTP Error: Could not connect to SMTP host.
2019-11-14 08:30:56 CLIENT -> SERVER: QUIT
2019-11-14 08:30:56 SERVER -> CLIENT:
2019-11-14 08:30:56 SMTP ERROR: QUIT command failed:
SMTP Error: Could not connect to SMTP host.

請問各位前輩有何建議嗎?
2019-11-14 18:20 發佈
Davisai wrote:
各位先知:最近有個需...(恕刪)

https://lib.webmail.hinet.net/statement/F-soft-1.htm

http://lib.webmail.hinet.net/statement/SAsetup.htm

連結3
非中華電信電路...要使用 msr.hinet.net + Port 587


SMTP驗證主機

伺服器名稱:msr.hinet.net
外寄伺服器需要驗證
連接埠號碼:587
加密連線類型:TLS 或 STARTTL

==== 我是熟 C# .Net Core =====
PHP...........>>>
$mail = new PHPMailer(true); // Passing `true` enables exceptions
try {
//Server settings
$mail->SMTPDebug = 2; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'msr.hinet.net'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'user@msa.hinet.net'; // SMTP username
$mail->Password = 'password'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to
.
.
.
.
.
內文搜尋
X
評分
評分
複製連結
Mobile01提醒您
您目前瀏覽的是行動版網頁
是否切換到電腦版網頁呢?