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 revision Previous revision
Last revision Both sides next revision
gmail_on_linux_with_ssmtp [2015/11/04 18:12]
juckins
gmail_on_linux_with_ssmtp [2015/11/04 18:17]
juckins
Line 47: Line 47:
 4 November 2015 4 November 2015
  
-Gmail stopped working.  ​Try a PHP or Perl solution? ​ Does it require SSMTP or MSMTP?+Gmail stopped working.  ​
  
 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 a PHP or Perl solution, but does it require SSMTP or MSMTP?
  
-Directions ​[[http://​mhawthorne.net/​posts/​postfix-configuring-gmail-as-relay.html|based on this page by Matthew Hawthorne]] worked: \\ +Final answer was to configure ​[[gmail_as_a_relay_on_linux|Gmail as a Relay]]
- +
-1. Make a backup copy of /​etc/​postfix/​main.cf +
- +
-2. Edit /​etc/​postfix/​main.cf to have these settings: +
- +
-<​code>​ +
-# sets gmail as relay +
-relayhost = [smtp.gmail.com]:​587 +
- +
-#  use tls +
-smtp_use_tls=yes +
- +
-# use sasl when authenticating to foreign SMTP servers +
-smtp_sasl_auth_enable = yes  +
- +
-# path to password map file +
-smtp_sasl_password_maps = hash:/​etc/​postfix/​sasl_passwd +
- +
-# list of CAs to trust when verifying server certificate +
-#​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 incompatible with Gmail +
-smtp_sasl_security_options = +
- +
-# add debugging +
-debug_peer_list=smtp.gmail.com +
-debug_peer_level=3 +
-</​code>​ +
- +
-2. Add your own Gmail credentials to /​etc/​postfix/​sasl_passwd \\ +
-<​code>​ +
-[smtp.gmail.com]:​587 ​ username:​password +
-</​code>​ +
- +
-3. Run 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>​ +
- +
-5. Tighten permissions:​ \\ +
-<​code>​ +
-# chmod 600 sasl_passwd sasl_passwd.db +
-</​code>​ +
- +
-6. Restart postfix: \\ +
-<​code>​ +
-# /​etc/​init.d/​postfix reload +
-</​code>​ +
-or +
-<​code>​ +
-# service postfix restart +
-</​code>​ +
- +
-7. Send test message: \\ +
-<​code>​ +
-echo 'It works' | mailx -s 'Test message'​ [email protected] +
-</​code>​ +
- +
-8. Check 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