Search code examples
smtpphpmailer

Why do Google SMTP server not work anymore?


I have used Google SMTP server for several years to send mail from my webpage but it does not work anymore. Nothing in my PHPMailer script is changed.

 $mail->Host = "ssl://smtp.gmail.com";
 $mail->Port = 465;
 $mail->SMTPAuth = true;

I get the following error.

 SMTP Error: Could not authenticate. 

Is this something Google have changed?


Solution

  • Google has a long history of breaking SMTP authentication. Set $mail->SMTPDebug = 2 and read the SMTP transcript, which will give you some clues. then read the PHPMailer troubleshooting guide which has lots to say on this subject.