Reputation: 185
This is my php file:
<?php
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
if(isset($_POST['send'])){
date_default_timezone_set('Etc/UTC');
$email = $_POST['email'];
$name = $_POST["name"];
$subject = $_POST["subject"];
$message = $_POST["message"];
$mail -> isSMTP();
$mail->PluginDir = "/path/to/phpmailer/dir";
$mail -> SMTPDebug = 1;
$mail -> Host = "smtp.gmail.com";
$mail -> SMTPSecure = "ssl";
$mail -> Port = 465;
$mail -> SMTPAuth = true;
$mail -> Username = "xxx"; //username [email protected]
$mail -> password = "xxx"; //password
$mail -> setFrom("[email protected]", "Anwar Elbouhdifi");
$mail -> addAddress($email, $name);
$mail -> Subject = $subject;
$mail -> Body = $message;
$mail -> AltBody = $message;
if(! $mail -> send()){
echo"message error: " . $mail -> ErrorInfo;
}else{
echo"Success!" ;
}
}
?>
And the mailer returns this error
2014-05-28 22:51:05 CLIENT -> SERVER: EHLO localhost 2014-05-28 22:51:05 CLIENT -> SERVER: AUTH LOGIN 2014-05-28 22:51:05 CLIENT -> SERVER: YXV0b2JhbmRlbmRpc2NvdW50QGdtYWlsLmNvbQ== 2014-05-28 22:51:05 CLIENT -> SERVER: 2014-05-28 22:51:05 SMTP ERROR: Password command failed: 535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 http://support.google.com/mail/bin/answer.py?answer=14257 r5sm46692086wjq.26 - gsmtp 2014-05-28 22:51:05 CLIENT -> SERVER: QUIT SMTP connect() failed. message error: SMTP connect() failed.
I know it says username and password not accepted but I know for 100% it is the right password and username.
Upvotes: 0
Views: 1093
Reputation: 6387
Probably not the solution but worth a try: spell Password with a big P.
Upvotes: 3