SMTP错误:无法验证 - 不是GMAIL,自己的VPS服务器

时间:2016-01-08 12:24:47

标签: php email ubuntu-14.04 phpmailer smtp-auth

我在google上搜索了大约18个小时,我的神经非常糟糕......甚至在stackoverflow上也是如此

首先,我是学生,对我糟糕的英语感到抱歉

我想做什么: 我正在准备我的新VPS服务器,我安装了Ubuntu 14.04以及最新版本的postfix来接收和发送来自此VPS的电子邮件(大约5000个客户端)。我也配置了我的Postfix .. 在我的域名上,我也使用最新的PHPMailer和PHP 5.5

我想在VPS上将我的域连接到SMTP并将此电子邮件中的电子邮件发送到另一台服务器......

我的问题: 我尝试了很多配置和替代方案,但仍然有这个错误,我的PHP脚本无法连接到我的SMTP主机

我发送电子邮件的.php文件:

<?php

    require_once("mailer/class.phpmailer.php");
    require_once("mailer/class.smtp.php");

    $mail = new PHPMailer();
    $mail->IsSMTP(); // telling the class to use SMTP

    $mail->SMTPSecure     = false;
    $mail->Host          = "mail.xxx.cz";
    $mail->SMTPAuth      = true;
    $mail->SMTPKeepAlive = true;
    $mail->Port          = 587;
    $mail->Username      = "michal@mail.xxx.cz";
    $mail->Password      = "TEST";
    $mail->SMTPDebug      = 3;

    $mail->FromName      = "Michal";
    $mail->From          = "michal@mail.xxx.cz";
    $mail->Subject       = "Newsletter";

    $mail->AltBody    = "To view the message, please use an HTML compatible email viewer!";
    $mail->MsgHTML("testing");
    $mail->AddAddress("filfareu@gmail.com");

    if(!$mail->Send()) {
        echo $mail->ErrorInfo;
        exit;
    } 
    echo "Message has been sent";

?>

我的VPS Postfix配置: http://fio.filfar.eu/files/Xj4qBxbYsi.png

PHP脚本中的我的SMTP错误日志(PHPMailer.php - 调试模式3):

2016-01-08 12:03:35 Connection: opening to mail.xxx.cz:587, timeout=300, options=array (
                                      )
2016-01-08 12:03:35 Connection: opened
2016-01-08 12:03:35 SERVER -> CLIENT: 220 vm1xxxx ESMTP Postfix (Ubuntu)
2016-01-08 12:03:35 CLIENT -> SERVER: EHLO blog.xxx.cz
2016-01-08 12:03:35 SERVER -> CLIENT: 250-vm1xxxx
                                      250-PIPELINING
                                      250-SIZE 10240000
                                      250-VRFY
                                      250-ETRN
                                      250-ENHANCEDSTATUSCODES
                                      250-8BITMIME
                                      250 DSN
2016-01-08 12:03:35 SMTP Error: Could not authenticate.
2016-01-08 12:03:35 CLIENT -> SERVER: QUIT
2016-01-08 12:03:35 SERVER -> CLIENT: 221 2.0.0 Bye
2016-01-08 12:03:35 Connection: closed
2016-01-08 12:03:35 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

我确信我的用户名和密码是正确的,也花了好几个小时......

非常感谢所有想要帮助的人。 我无法解决这个问题......

2 个答案:

答案 0 :(得分:0)

我认为您需要首先交叉检查您的smtp详细信息。 您可以在线查看http://smtper.nanogenesis.fr/

答案 1 :(得分:0)

您正在连接到端口587(SMTP提交协议端口),但是当您连接时,您的服务器未在其功能列表中提供AUTH或STARTTLS命令,因此您的客户端无法进行身份验证。您需要修复后缀服务器配置。

相关问题