Answers.Body: <p>It's possible to use Google Apps or GMail SMTP directly, but you will have to deal both with limitations of remote SMTP and with any resource limits enforced on your account (esp if using an @gmail.com or similar address).</p>
  
  <p>If you have control of your server, I recommend using Postfix as a local MTA and configuring it to smarthost via Google Apps.</p>
  
  <ul>
  <li>You'll see much better performance from CiviCRM if it can hand mails off rapidly to a local MTA, and </li>
  <li>Postfix is far better at conversing with Google SMTP than CiviCRM.</li>
  </ul>
  
  <p>See <a href="https://civicrm.stackexchange.com/questions/377/how-do-i-configure-smtp-with-starttls/621#621">How do I configure SMTP with STARTTLS?</a> (related question/answer) for why that is.</p>
  
  <h3>How to do this via Postfix relay instead</h3>
  
  <p>(This requires control of your hosting environment.)</p>
  
  <p>In <code>/etc/postfix/main.cf</code>, configure</p>
  
  <pre><code>relayhost = [smtp.gmail.com]:587
  smtp_use_tls=yes
  smtp_sasl_auth_enable = yes
  smtp_sasl_mechanism_filter = plain
  smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
  smtp_sasl_security_options = 
  </code></pre>
  
  <p>In <code>/etc/postfix/sasl_passwd</code>, enter</p>
  
  <pre><code>[smtp.gmail.com]:587  yourusername@example.org:password
  </code></pre>
  
  <p>Run <code>sudo postmap /etc/postfix/sasl_passwd</code></p>
  
  <p>Run <code>sudo service postfix reload</code></p>
  
  <p>Now use local mail delivery, and watch <code>/var/log/mail.log</code> to ensure it gets handed off to Google's servers for delivery.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-17T22:56:16.640Z
Answers.Text: http://mhawthorne.net/posts/postfix-configuring-gmail-as-relay.html is a good reference for this - there are plenty of recipes online for this method.
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-18T12:54:56.307Z
Answers.Text: Thank you, this answer was really helpful. I found it also helped to get a higher level of detail in the postfix log entry to see what the problem was whcih I was able to implement using http://www.postfix.org/postconf.5.html#debug_peer_list. Also, for some reason my Gmail account needed to use port 465.
Answers.UserDisplayName: Ben
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-18T13:04:09.213Z
Answers.Text: It is also important to check that Gmail Less Secure Access is turned on for your local email account at https://www.google.com/settings/security/lesssecureapps. You may also need to update the Less Secure Access in the Admin console to let users choose their own setting at https://admin.google.com/ac/security/lsa?journey=46
Answers.UserDisplayName: Ben
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-19T23:04:07.363Z
Answers.Text: Great to hear. Worth noting that this answer dates from 2015 and information in it will have aged since then!
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-17T22:54:58.600Z
Answers.LastActivityDate: 2015-08-17T22:54:58.600Z
Answers.LastEditDate: 2017-04-13T12:53:13.167Z
Answers.UserDisplayName: Chris Burgess
Body: <p>My mails are not being sent, even when I choose to send immediately.</p>
  
  <p>My domain uses Gmail servers to handle our email accounts.</p>
  
  <p>I'm assuming my settings at /civicrm/admin/mailSettings?action=update&amp;id=1&amp;reset=1 are not correct but I can't find any good tutorials.  The documentation is not helpful to me.</p>
  
Tags: <civimail>
Title: how to configure civimail when using Google mail?
ThreadText: # how to configure civimail when using Google mail?
  
  (Asked by: username_0 on 2015-08-17)
  
  My mails are not being sent, even when I choose to send immediately.
  
  My domain uses Gmail servers to handle our email accounts.
  
  I'm assuming my settings at /civicrm/admin/mailSettings?action=update&id=1&reset=1 are not correct but I can't find any good tutorials. The documentation is not helpful to me.
  
  **Tags:** civimail
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-08-17. Score: 6
  
  It's possible to use Google Apps or GMail SMTP directly, but you will have to deal both with limitations of remote SMTP and with any resource limits enforced on your account (esp if using an @gmail.com or similar address).
  
  If you have control of your server, I recommend using Postfix as a local MTA and configuring it to smarthost via Google Apps.
  
  * You'll see much better performance from CiviCRM if it can hand mails off rapidly to a local MTA, and
  * Postfix is far better at conversing with Google SMTP than CiviCRM.
  
  See [How do I configure SMTP with STARTTLS?](https://civicrm.stackexchange.com/questions/377/how-do-i-configure-smtp-with-starttls/621#621) (related question/answer) for why that is.
  
  ### How to do this via Postfix relay instead
  
  (This requires control of your hosting environment.)
  
  In `/etc/postfix/main.cf`, configure
  
  ```
  relayhost = [smtp.gmail.com]:587
  smtp_use_tls=yes
  smtp_sasl_auth_enable = yes
  smtp_sasl_mechanism_filter = plain
  smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
  smtp_sasl_security_options = 
  
  ```
  
  In `/etc/postfix/sasl_passwd`, enter
  
  ```
  [smtp.gmail.com]:587  yourusername@example.org:password
  
  ```
  
  Run `sudo postmap /etc/postfix/sasl_passwd`
  
  Run `sudo service postfix reload`
  
  Now use local mail delivery, and watch `/var/log/mail.log` to ensure it gets handed off to Google's servers for delivery.
  
  > **Comments:**
  > **username_1**: http://mhawthorne.net/posts/postfix-configuring-gmail-as-relay.html is a good reference for this - there are plenty of recipes online for this method.  
  > **username_2**: Thank you, this answer was really helpful. I found it also helped to get a higher level of detail in the postfix log entry to see what the problem was whcih I was able to implement using http://www.postfix.org/postconf.5.html#debug_peer_list. Also, for some reason my Gmail account needed to use port 465.  
  > **username_2**: It is also important to check that Gmail Less Secure Access is turned on for your local email account at https://www.google.com/settings/security/lesssecureapps. You may also need to update the Less Secure Access in the Admin console to let users choose their own setting at https://admin.google.com/ac/security/lsa?journey=46  
  > **username_1**: Great to hear. Worth noting that this answer dates from 2015 and information in it will have aged since then!  
  
  ---
  
  