![](/img/trans.png)
[英]PHPMailer's infamous SMTP ERROR: Failed to connect to server: Connection timed out (110) SMTP connect() failed
[英]SMTP ERROR: Failed to connect to server: Connection timed out (110) with PHPMailer and Outlook SMTP
我正在使用PHP Mailer和Outlook SMTP獲得SMTP錯誤。 我在這里很困惑,因為它在端口號為25的localhost上工作正常,但它不能在Hosting Server上工作,我已嘗試使用SSL和TLS的所有端口。
錯誤: SMTP錯誤:無法連接到服務器:連接超時(110)
我的代碼:
<?php
include("PHPMailer.php");
error_reporting(E_ALL);
ini_set('display_errors', '1');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp.live.com";
$mail->SMTPDebug = 2;
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Username = "info@neelcomputech.com";
$mail->Password = "password";
$mail->Priority = 1;
$mail->CharSet = 'UTF-8';
$mail->ContentType = 'text/html; charset=utf-8\r\n';
$mail->From = "info@neelcomputech.com";
$mail->FromName = $name;
$mail->AddAddress("info@neelcomputech.com");
$mail->IsHTML(true);
$mail->Subject = "You got Message from Website";
$mail->Body = "testing";
if(!$mail->Send())
{
echo 'Mailer Error: ' . $mail->ErrorInfo;
}
else
{
echo 'success';
}
?>
請幫我解決這個問題。 我有共享Linux主機。
我有一個類似的問題,結果我的主機(Bluehost)阻止了端口465上的傳出連接。我將在這里發布解決方案,希望能幫到你。 但我不夠專業,不知道是否是同一個問題。
我找到了一個很好的操作方法 ,為我修好了它:
這些答案都不適合我。 幾個小時后,我發現了問題,但只適用於Cpanel / WHM
如果您無法訪問WHM,請咨詢您的提供商。
希望能幫助到你!
你的主機不支持Mos phpmailer。 您必須通過創建新文件並檢查簡單的php電子郵件功能來進行交叉檢查。 很可能SMTP不在您的托管服務提供商處配置
<?php
$to = "somebody@example.com";
$subject = "My subject";
$headers = "From: webmaster@example.com" . "\r\n" .
"CC: somebodyelse@example.com";
mail($to,$subject,$headers);
?>
我的代碼是正確的。
問題在於托管服務提供商。 我聯系了他們,他們在他們的服務器上做了一些配置,就完成了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.