错误:端口587上的消息提交需要SMTP AUTH

时间:2015-10-09 09:21:57

标签: phpmailer smtp-auth

    <?php
    require("../PHPMailer_5.2.4/class.phpmailer.php");

    $mail = new PHPMailer(); // create a new object

    $mail->IsSMTP(); // enable SMTP
    $mail->SMTPDebug = 1; 
    $mail->SMTPSecure = 'tls';
    $mail->Host = "smtp.gmail.com";
    $mail->Port = 587; 
    $mail->SMTPAuth = true; 
    $mail->IsHTML(true);
    $mail->Username = '*******@gmail.com';
    $mail->Password = '*******';
    $mail->setFrom('*******@gmail.com');

    $mail->Subject = "Test";
    $mail->Body = "hello";
    $mail->addAddress("*******@gmail.com");
    if(!$mail->Send())
    {
        echo "Mailer Error: " . $mail->ErrorInfo;
    }
    else
    {
       echo "Message has been sent";
    }

    ?>

给出以下错误: SMTP - &gt;错误:服务器不接受密码:535验证数据不正确 SMTP - &gt;错误:服务器不接受RCPT:在端口587上提交消息需要550 SMTP AUTH SMTP错误:以下收件人失败:**** @gmail.com邮件程序错误:SMTP错误:以下收件人失败:**** @ gmail.com SMTP服务器错误:端口587上的消息提交需要SMTP AUTH

0 个答案:

没有答案