0

私はかなり長い間試してきましたが、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:

何が間違っていたのかわかりません。これを修正する解決策はありますか?

4

1 に答える 1

1

この行が問題です:

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

メールサーバーはログインする必要があり、提供しているパスワード資格情報が受け入れられていません。ポストマスターに相談して、正しいユーザー名とパスワードを持っていることを確認してください。

それができない場合は、スクリプトの詳細を使用してコマンド ラインから SMTP サーバーにログオンし、エラーが発生するかどうかを確認します。

于 2012-05-14T14:07:00.133 に答える