Google Apps (Gmail) SMTP and ExpressionEngine


- Lance Johnson 10.16.2014

Have you ever tried to configure ExpressionEngnine to send e-mail using Google App SMTP? If you have, you know that there are a few challenges. Reading the official Google instructions on using SMTP to send e-mail through Google Apps / Gmail, you would think that all you have to do is add the smtp.gmail.com address, set your port to 465, and enter your credentials. Unfortunately, doing so only seems to result in a dreaded “unable to send email at this time” error message.

Google Apps SMTP error in ExpressionEngine

Google Apps SMTP error in ExpressionEngine

Wow. What a useful error. I found one place on the ExpressionEngine forums that suggested you could solve this issue by setting the SMTP Server Address to ssl://smtp.gmail.com; however, this also failed for me. There were a few things I found that suggested hacking core files, but, really, why would I want to do that? Finally, I stumbled upon a reference to some config.php settings that might be useful. In the end, I was able to solve this by setting the SMTP server address using ssl:// and also adding the following two lines to my EE config.php file:

$config[‘email_newline’] = “\r\n”;
$config[‘email_crlf’] = “\r\n”;

Valid Google App SMTP setting in EE (use your own credentials, of course)

Valid Google Apps SMTP settings in EE (use your own credentials, of course)

Success! ExpressionEngine can send e-mail using Google Apps SMTP.

Success! ExpressionEngine can send e-mail using Google Apps SMTP.

Good luck!

schedule a call
Comments