I have used phpmailer() concept to send mail to users from my shared server using php script, but I'm not able to send even though everything is right in my script according to phpmailer code.
My code like this:
$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 = "[email protected]"; // My gmail username
$mail->Password = "************"; // My Gmail Password
$mail->SetFrom("[email protected]");
$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;
}
Note: I have used " GMail " as my SMTP server and SMTPSecure is " ssl " and port is "465" and username & passwords are my GMail username & password
I used VPS shared server and I kept my php script on that server.
I think there is no problem in my php script and I don't know why it doesn't work.
I got the ERROR like this.
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.
Please give some solution for that.
Thanks in Advance.
Remember: I use Shared Server Name 'VPS.mydomain.com' and I want to use GMail as my SMTP server to send mail to users.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…