PHPMailer and GMAIL

JTS

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);

About the author

During his twenty-five professional years, Mr. Silva has had experience in nearly every facet of the Information Technology industry. Ranging from advanced data mining / data visualization systems to running multi-state small business IT infrastructures, Mr. Silva has always provided precise and cost-effective strategies to meet any client’s needs. With his tremendous work ethic and “Can-Do” attitude, Mr. Silva has always met every challenge head-on and with intelligent determination. Mr. Silva is also a certified NAUI Advanced/Nitrox Diver, hoping to get a few more wrecks under his belt in the Atlantic.