【问题标题】:Connection to SMTP server via PHPMailer通过 PHPMailer 连接到 SMTP 服务器
【发布时间】:2014-04-29 16:26:41
【问题描述】:

我在使用 PHPMailer 时遇到了一些问题 - 它无法连接到 SMTP 服务器。 我使用以下设置:

$mail->Host = "mail.site.com";
$mail->SMTPAuth = true;
$mail->Port = 26;
$mail->Username = "test@site.com";
$mail->Password = "***";

当我尝试连接时 - 我收到错误“SMTP 错误:无法连接到 SMTP 主机”。 我也尝试设置:

$mail->SMTPSecure = 'ssl';
OR
$mail->SMTPSecure = 'tls';

但错误仍然存​​在。

在我的电子邮件客户端 (Thunderbird) 中设置:

Server - mail.site.com
Port - 26
Secure Connection - STARTTLS
Username - test@site.com

我连接成功并且可以发送/接收电子邮件。同样通过 telnet mail.site.com 26 我成功连接。

为什么相同的设置无法连接到服务器?

【问题讨论】:

    标签: php email smtp phpmailer


    【解决方案1】:

    首先你应该read the docs。你确定你应该连接到端口 26 吗? SMTP 通常在端口 25(入站)上运行,您通常应该在端口 587 上使用 tls 发送。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-09-25
      • 2015-05-09
      • 2016-07-20
      • 1970-01-01
      • 2018-10-26
      • 2014-03-17
      • 1970-01-01
      相关资源
      最近更新 更多