猿问

PHPMailer - SMTP ERROR:从我的服务器发送邮件时密码命令失败

PHPMailer - SMTP ERROR:从我的服务器发送邮件时密码命令失败

我已经使用phpmailer()概念使用php脚本从我的共享服务器向用户发送邮件,但是根据phpmailer代码,即使我的脚本中的所有内容都正确,我也无法发送。

我的代码是这样的:

  $message = " This is testing message from my server";

  $mail = new PHPMailer(); // create a new object
  $mail->IsSMTP(); // enable SMTP
  $mail->Host = "smtp.gmail.com";
  $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
  $mail->SMTPAuth = true; // authentication enabled
  $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
  $mail->Port = 465; // or 587
  $mail->IsHTML(true);
  $mail->Username = "moorthi.mrk10@gmail.com"; // My gmail username
  $mail->Password = "************"; // My Gmail Password
  $mail->SetFrom("moorthi.mrk10@gmail.com");
  $mail->Subject = "Test Mail from my Server";
  $mail->Body = $message;
  $mail->AddAddress($email);
   if($mail->Send())
      {
    print json_encode("SUCCESS");}else{
    echo "Mailer Error: " . $mail->ErrorInfo;}

注意: 我使用“GMail”作为我的SMTP服务器,SMTPSecure是“ssl”,端口是“465”,用户名和密码是我的GMail用户名和密码

我使用VPS共享服务器,并将我的PHP脚本保存在该服务器上。

我认为我的PHP脚本没有问题,我不知道为什么它不起作用。

我得到了这样的错误。

  2014-02-21 12:30:11   CLIENT -> SERVER: EHLO jkcorporates.com  2014-02-21 12:30:11   CLIENT -> SERVER: AUTH LOGIN  2014-02-21 12:30:11   CLIENT -> SERVER: bW9vcnRoaS5tcmsxMEBnbWFpbC5jb20=
  2014-02-21 12:30:11   CLIENT -> SERVER: OTk0MTI0MTE0MA==
  2014-02-21 12:30:11   SMTP ERROR: Password command failed: 534-5.7.14 
  534-5.7.14 i-_eumA> Please log in via your web browser and then try again.
  534 5.7.14 54 k76sm17979938yho.18 - gsmtp  2014-02-21 12:30:11   CLIENT -> SERVER: QUIT  " The ERROR is  "  SMTP connect() failed.

请给出一些解决方案。
提前致谢。

请记住:我使用共享服务器名称'VPS.mydomain.com',我想使用GMail作为我的SMTP服务器向用户发送邮件。


一只甜甜圈
浏览 1507回答 2
2回答
随时随地看视频慕课网APP
我要回答