簡體   English   中英

SMTP錯誤:無法連接到服務器:使用PHPMailer和Outlook SMTP連接超時(110)

[英]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上的傳出連接。我將在這里發布解決方案,希望能幫到你。 但我不夠專業,不知道是否是同一個問題。

我找到了一個很好的操作方法 ,為我修好了它:

  1. 在cPanel DNS區域編輯器中,找到MX(郵件交換器)部分,然后選擇“遠程郵件交換器”。
  2. 在cPanel電子郵件帳戶部分中,創建相應的電子郵件地址(不要跳過此內容)
  3. 不要使用“smtp.live.com”作為smtp主機。 使用您的Shared Linux Hosting smtp的smtp主機。 我不知道你會如何得到你的。 我的是boxXXXX.bluehost.com。
  4. 將您的用戶名和密碼設置為與您在cPanel中設置的電子郵件帳戶相同。

這些答案都不適合我。 幾個小時后,我發現了問題,但只適用於Cpanel / WHM

  • 登錄WHM。
  • 轉到ConfigServer Security&Firewall inside plugins選項。
  • 單擊防火牆配置
  • 按SMTP設置過濾
  • 查找SMTP_ALLOWUSER選項並添加由昏迷分隔的Cpanel帳戶的用戶名
  • 重啟防火牆。

如果您無法訪問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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM