【问题标题】:phpmailer smtp not workingphpmailer smtp 不工作
【发布时间】:2012-05-21 19:10:21
【问题描述】:

我已经尝试了很长时间,但我无法让 phpmailer 与 smtp 一起工作。 我一直在这里测试http://smtper.sweetylife.com/,看看我的 smtp 是否正常工作,在这个网站上我可以毫无问题地连接。 我的 phpmailer 设置是:

    $mail   = new PHPMailer();
    $mail->IsSMTP(); // telling the class to use SMTP
    $mail->Host       = "mail.mydomain.com"; // SMTP Server
    $mail->SMTPDebug  = 2; // Debugmode
    $mail->SMTPAuth   = true; // enable SMTP authentication
    $mail->SMTPSecure = "tls";
    $mail->Port       = 587; // set the SMTP port for the GMAIL
    $mail->Username   = "administratie@mydomain.com"; // SMTP account username
    $mail->Password   = "password";        // SMTP account password
    //$mail->SetFrom("administratie@mydomain.com", "First Last");
    $mail->AddReplyTo("administratie@mydomain.com","First Last");
    $mail->Subject    = "PHPMailer Test Subject via smtp, basic with authentication";
    //$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
    $mail->Body       = "demo mail";
    $address = "re@ceiv.ed";
    $mail->AddAddress($address, "John Doe");
    if(!$mail->Send()) {
        echo "Mailer Error: " . $mail->ErrorInfo;
    }
    else{
        echo "Message sent!";
    }

但它不起作用。 我收到以下错误:

SMTP -> FROM SERVER: 220 helios.web.xyn-ta.net ESMTP Exim 4.77 Mon, 14 May 2012 11:47:16 +0200
SMTP -> FROM SERVER: 250 helios.web.xyn-ta.net Hello localhost.localdomain [77.243.225.73]
SMTP -> FROM SERVER: 250 OK
SMTP -> FROM SERVER: 550 relay not permitted, authentication required
SMTP -> ERROR: RCPT not accepted from server: 550 relay not permitted, authentication required
SMTP -> FROM SERVER: 503-All RCPT commands were rejected with this error:
503-relay not permitted, authentication required
503 valid RCPT command must precede DATA
SMTP -> ERROR: DATA command not accepted from server: 503-All RCPT commands were rejected with this error:
503-relay not permitted, authentication required
503 valid RCPT command must precede DATA
SMTP -> FROM SERVER: 221 helios.web.xyn-ta.net closing connection
Mailer Error:

我不知道我做错了什么,有人有解决办法吗?

【问题讨论】:

    标签: php email smtp phpmailer smtp-auth


    【解决方案1】:

    这行是问题所在:

    SMTP -> FROM SERVER: 550 relay not permitted, authentication required
    

    您的邮件服务器需要登录,并且您提供的密码凭据未被接受。您应该与邮政主管联系,并确保您拥有正确的用户名和密码。

    如果失败,请尝试使用脚本中的详细信息从命令行登录 SMTP 服务器,看看是否会产生任何错误。

    【讨论】:

    • 是的,我知道,但我已经测试了服务器并在smtper.sweetylife.com 登录,一切都立即运行,在我的脚本中使用完全相同的脚本,它不起作用。
    • 所以相同的代码在两台不同的服务器上运行 - 它在一个服务器上运行,但在另一个服务器上失败?在这种情况下,这将是服务器配置问题 - 我想您尝试连接的邮件服务器不接受来自第三方服务器的连接。与那里的邮政主管交谈,看看您是否可以将第二台服务器添加到邮件服务器将接受来自其的连接的服务器列表中。
    猜你喜欢
    • 1970-01-01
    • 2014-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-15
    • 2014-08-24
    • 1970-01-01
    相关资源
    最近更新 更多