Is it possible to use gmail as the smtp server for sending e-mail out from ExpressionEngine? It looks like you need to be able to set a different port and i'm not sure you can do it from the E-mail config page in the EE admin area?
With Google's move toward stricter security measures regarding how third-parties connect with their services, there's now another step required to set up ExpressionEngine to send email through Gmail. Beginning to end, here's how to do it.
Step 1: Allow "Less Secure Apps" to Access Gmail
Sign in to the Gmail (or Gmail-powered Google Apps) account you want to use and open up the "less secure apps" section under My Account.
Turn on access for less secure apps.
Step 2: Configure ExpressionEngine
In your config.php file, copy over these config items and modify the username and password. Note that the username must be the full email address, and the value for
$config['email_newline'] must be enclosed in double quotes.
$config['mail_protocol'] = 'smtp'; $config['email_newline'] = "\r\n"; $config['email_smtp_crypto'] = 'ssl'; $config['smtp_server'] = 'smtp.gmail.com'; $config['smtp_port'] = '465'; $config['smtp_username'] = 'firstname.lastname@example.org'; $config['smtp_password'] = 'xxxxxxxxx';
This has been tested thoroughly in ExpressionEngine 2.10.1, though given the availability of config overrides, it should work with EE 2.6+. For older versions, just omit the line for
$config['email_smtp_crypto'] and use
ssl://smtp.gmail.com as the value for
Step 3: Test
Make sure it works before you push these changes live. I haven't tested in all possible network configurations or with all possible EE versions. If you find a scenario that requires something different, drop it in the comments.
Pretty sure because of Gmail's forced use of SSL connections this work around is still required in EE 2. I don't remember this being corrected in recent releases of EE v2 but I could be mistaken:
I don't know if this will work for you or not, but I was able to set up Google smtp over TLS with a few additions to the config:
$env_conf['mail_protocol'] = 'smtp'; $env_conf['smtp_server'] = 'tls://smtp.gmail.com:XXX'; // Use :XXX to set the port number. $env_conf['smtp_username'] = 'email@example.com'; $env_conf['smtp_password'] = 'xxx'; $env_conf['email_newline'] = "\r\n"; $env_conf['email_crlf'] = "\r\n"; $config['smtp_port'] = "xxx"; //replace with your port number
In my particular case I just added the last 3 to a config bootstrap and set up the rest through the cpanel.
Most of this came from this Gist https://gist.github.com/experience/2557044 and the EE hidden config vars docs: http://ellislab.com/expressionengine/user-guide/general/hidden_configuration_variables.html#smtp-port
Hopefully that works for someone :)