【问题标题】:SMTP ERROR: Failed to connect to server: Connection timed out (110) with PHPMailer and Outlook SMTPSMTP 错误:无法连接到服务器:PHPMailer 和 Outlook SMTP 连接超时 (110)
【发布时间】:2014-07-10 01:35:22
【问题描述】:

PHP Mailer 和 Outlook SMTP 出现 SMTP 错误。我在这里感到困惑,因为它在端口号为 25 的 localhost 上运行良好,但在托管服务器上却无法运行,我已尝试使用 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 主机。

【问题讨论】:

  • 你已经解决了问题?
  • @JorgeB.,是的,我做到了。
  • 用你的决心回答。
  • @JorgeB.,问题出在托管服务提供商上。我就这个问题联系了他们,他们在他们的服务器上做了一些配置并完成了。
  • @Martin 抱歉耽搁了。我发布了一个答案。

标签: php email ssl


【解决方案1】:

我的代码是正确的。
问题在于托管服务提供商。我就此事联系了他们,他们在他们的服务器上进行了一些配置,并且完成了。

【讨论】:

    【解决方案2】:

    没有一个答案对我有用。 几个小时后,我发现了问题,但仅适用于 Cpanel/WHM

    • 登录 WHM。
    • 转到 ConfigServer Security & Firewall inside plugins 选项。
    • 点击防火墙配置
    • 按 SMTP 设置过滤
    • 查找 SMTP_ALLOWUSER 选项并添加以逗号分隔的 Cpanel 帐户的用户名
    • 重新启动防火墙。

    如果您无法访问 WHM,请咨询您的提供商。

    希望对你有帮助!

    【讨论】:

      【解决方案3】:

      我遇到了类似的问题,结果我的主机 (Bluehost) 阻止了端口 465 上的传出连接。我将在此处发布解决方案,希望对您有所帮助。但我不够专业,无法知道这是否是同一个问题。

      我找到了一个很棒的how-to,它为我修复了它:

      1. 在您的 cPanel DNS 区域编辑器中,找到 MX(邮件交换器)部分,然后选择“远程邮件交换器”。
      2. 在 cPanel 电子邮件帐户部分,创建适当的电子邮件地址(不要跳过此步骤)
      3. 不要使用“smtp.live.com”作为您的 smtp 主机。使用共享 Linux 主机 smtp 的 smtp 主机。我不知道你将如何得到你的。我的是 boxXXXX.bluehost.com。
      4. 将您的用户名和密码设置为与您刚刚在 cPanel 中设置的电子邮件帐户相同。

      【讨论】:

      • blocking 465..... pfft....就像说如果你锁上你的门我们会打破你的窗户:-(
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-20
      • 1970-01-01
      • 1970-01-01
      • 2018-05-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多