Christopher Juckins

SysAdmin Tips, Tricks and other Software Tools

User Tools

Site Tools


gmail_on_linux_with_ssmtp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
gmail_on_linux_with_ssmtp [2015/11/04 17:55] juckinsgmail_on_linux_with_ssmtp [2015/11/04 18:12] juckins
Line 51: Line 51:
 This did not work: https://productforums.google.com/forum/?hl=en#!topic/gmail/2tK2fR7yW-k;context-place=forum/gmail This did not work: https://productforums.google.com/forum/?hl=en#!topic/gmail/2tK2fR7yW-k;context-place=forum/gmail
  
-Try these links:\\ 
  
-https://www.digitalocean.com/community/tutorials/how-to-use-gmail-or-yahoo-with-php-mail-function \\ +Directions [[http://mhawthorne.net/posts/postfix-configuring-gmail-as-relay.html|based on this page by Matthew Hawthorne]] worked: \\
-http://serverfault.com/questions/194376/how-to-send-email-with-my-centos-server \\ +
-http://rs20.mine.nu/w/2011/07/gmail-as-relay-host-in-postfix/ \\+
  
 +1. Make a backup copy of /etc/postfix/main.cf
  
-These directions [[http://mhawthorne.net/posts/postfix-configuring-gmail-as-relay.html|based on this page]] worked: \\ +2. Edit /etc/postfix/main.cf to have these settings:
- +
-  - Make a backup copy of /etc/postfix/main.cf +
-  - Edit /etc/postfix/main.cf to have these settings +
-  -   * # sets gmail as relay +
-  -   * Unordered List Item +
- +
-1. Edit /etc/postfix/main.cf+
  
 +<code>
 # sets gmail as relay # sets gmail as relay
 relayhost = [smtp.gmail.com]:587 relayhost = [smtp.gmail.com]:587
Line 80: Line 72:
  
 # list of CAs to trust when verifying server certificate # list of CAs to trust when verifying server certificate
-smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt+#smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt 
 +# Below is provided by ca-certificates package (Mozilla CA root certificate bundle) 
 +smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
  
-# eliminates default security options which are imcompatible with gmail+# eliminates default security options which are incompatible with Gmail
 smtp_sasl_security_options = smtp_sasl_security_options =
  
-If you need further debugging you can add these: +add debugging
 debug_peer_list=smtp.gmail.com debug_peer_list=smtp.gmail.com
 debug_peer_level=3 debug_peer_level=3
 +</code>
  
-2. Add Gmail creds to /etc/postfix/sasl_passwd+2. Add your own Gmail credentials to /etc/postfix/sasl_passwd \\ 
 +<code> 
 +[smtp.gmail.com]:587  username:password 
 +</code>
  
-[smtp.gmail.com]:587  username:password+3Run the following as root\\ 
 +<code> 
 +# postmap /etc/postfix/sasl_passwd 
 +</code> 
 + 
 +4. Make sure the /etc/sasl_passwd* files are owned by the postfix user\\ 
 +<code> 
 +# chown postfix sasl_passwd* 
 +</code>
  
-3Run sudo postmap /etc/postfix/sasl_passwd+5Tighten permissions: \\ 
 +<code> 
 +# chmod 600 sasl_passwd sasl_passwd.db 
 +</code>
  
-Make sure the /etc/sasl_passwd* files are owned by the postfix user:+6. Restart postfix: \\ 
 +<code> 
 +/etc/init.d/postfix reload 
 +</code> 
 +or 
 +<code> 
 +# service postfix restart 
 +</code>
  
-sudo chown postfix sasl_passwd*+7. Send a test message: \\ 
 +<code> 
 +echo 'It works' | mailx -s 'Test message' [email protected] 
 +</code>
  
-4Run /etc/init.d/postfix reload+8Check mutt configuration for proper "From" settings 
  
 +Other links:\\
  
 +[[http://serverfault.com/questions/194376/how-to-send-email-with-my-centos-server|How to send email with my CentOS server]] \\
 +[[http://rs20.mine.nu/w/2011/07/gmail-as-relay-host-in-postfix/|Setting up gmail as a relay host in postfix (without creating certificates)]] \\
 +[[https://www.digitalocean.com/community/tutorials/how-to-use-gmail-or-yahoo-with-php-mail-function|How To Use Gmail or Yahoo with PHP mail() Function]] \\
 +[[https://techjourney.net/update-add-ca-certificates-bundle-in-redhat-centos/|Updating certificates]] (not needed at this point)
gmail_on_linux_with_ssmtp.txt · Last modified: 2016/10/22 08:29 by juckins