Close

September 24, 2012

PHPMailer and GMAIL

We had a project where we are using PhPMailer to send emails out from an existing gmail account. While sending emails from a local SMTP server worked like a charm, we kept getting ” AUTH not accepted from server:” errors every time we tried using our gmail accounts.

As it turns out, GMAIL always uses SSL when sending email, but PhpMailer does NOT automatically handle this.
Simple solution, change your SMTP host to specify SSL (also make sure you are using PORT 465) for the server connection.

define('EMAIL_SMTP_HOST','ssl://smtp.gmail.com'); //google requires SSL
define('EMAIL_PORT',465);