[英]SMTP ERROR: Failed to connect to server: Connection timed out (110) with PHPMailer and Outlook SMTP
I am getting SMTP Error with PHP Mailer and Outlook SMTP. 我正在使用PHP Mailer和Outlook SMTP获得SMTP错误。 I am confused here because it is working fine on localhost with Port number 25 but It is not working on Hosting Server, I have tried all ports with SSL & TLS.
我在这里很困惑,因为它在端口号为25的localhost上工作正常,但它不能在Hosting Server上工作,我已尝试使用SSL和TLS的所有端口。
Error : SMTP ERROR: Failed to connect to server: Connection timed out (110)
错误: SMTP错误:无法连接到服务器:连接超时(110)
My Code: 我的代码:
<?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';
}
?>
Please help me to solve this issue. 请帮我解决这个问题。 I have Shared Linux Hosting.
我有共享Linux主机。
I had a similar problem, and it turned out my host (Bluehost) blocked outgoing connections on port 465. I will post the solution here in the hope that helps you. 我有一个类似的问题,结果我的主机(Bluehost)阻止了端口465上的传出连接。我将在这里发布解决方案,希望能帮到你。 But I'm not expert enough to know if it's the same problem or not.
但我不够专业,不知道是否是同一个问题。
I found a wonderful how-to which fixed it for me: 我找到了一个很好的操作方法 ,为我修好了它:
None of the answers worked for me. 这些答案都不适合我。 After many hours, I found the problem, but only works for Cpanel/WHM
几个小时后,我发现了问题,但只适用于Cpanel / WHM
If you don't have access to WHM ask your provider. 如果您无法访问WHM,请咨询您的提供商。
Hope it helps! 希望能帮助到你!
Mos probably phpmailer not supported by your hosting. 你的主机不支持Mos phpmailer。 You must have to cross check by creating new file and check simple php email function.
您必须通过创建新文件并检查简单的php电子邮件功能来进行交叉检查。 Most probably SMTP not configure at your hosting provider
很可能SMTP不在您的托管服务提供商处配置
<?php
$to = "somebody@example.com";
$subject = "My subject";
$headers = "From: webmaster@example.com" . "\r\n" .
"CC: somebodyelse@example.com";
mail($to,$subject,$headers);
?>
My code is correct. 我的代码是正确的。
The issue was with Hosting Provider. 问题在于托管服务提供商。 I contacted them about this and they did some configuration on their Server and it's done.
我联系了他们,他们在他们的服务器上做了一些配置,就完成了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.