Christopher Juckins

SysAdmin Tips, Tricks and other Software Tools

User Tools

Site Tools


gmail_as_a_relay_on_linux

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_as_a_relay_on_linux [2015/11/04 19:10] juckinsgmail_as_a_relay_on_linux [2020/09/30 16:07] juckins
Line 1: Line 1:
-Test platforms: \\ +===== Using Gmail as a Relay on CentOS Linux ===== 
-  * CentOS7 7.1.1503 (Core+ 
-  * CentOS6 6.7+Required packages if CentOS6 6.7: \\ 
 +  * postfix (tested version 2:2.6.6-6.el6_5) 
 +  * ca-certificates.noarch (tested version 2015.2.4-65.0.1.el6_6) 
 + 
 +Required packages if CentOS7 7.2.1511: \\ 
 +  * postfix (tested version 2.10.1-6.el7 ) 
 +  * ca-certificates.noarch (tested version 2015.2.4-70.0.el7_1
 +  * cyrus-sasl-plain (tested version 2015.2.6-70.1.el7_2) 
 +    * Got hint that this is needed from [[http://www.postfix.org/SASL_README.html#client_sasl_policy|Postfix config]] 
 +  * cyrus-sasl-lib (tested version 2.1.26-20.el7_2) 
 + 
 +Other CentOS Notes: 
 +  * Best to use this version of mutt: mutt-1.6.2-1.fc22.x86_64.rpm 
 +    * Otherwise, you may get errors like: Bad IDN in "from": 'tidewater.�' 
 +  * /etc/resolv.conf may need the 'search' pattern, ex: search attlocal.net 
 +    * As root, run 'nmtui' to set network parameters 
 +  * If trouble sending after install, may need to consult [[http://unix.stackexchange.com/questions/109473/after-updating-ssmtp-to-version-2-61-i-cannot-send-mail-via-gmail|this link]]
  
 Directions [[http://mhawthorne.net/posts/postfix-configuring-gmail-as-relay.html|based on this page by Matthew Hawthorne]]: \\ Directions [[http://mhawthorne.net/posts/postfix-configuring-gmail-as-relay.html|based on this page by Matthew Hawthorne]]: \\
  
-1. Make sure /etc/ssmtp/ssmtp.conf is the distro version (no changes)+1. If installed, make sure /etc/ssmtp/ssmtp.conf is the distro version (no changes, is not needed on CentOS 7 and not existent on CentOS8)
  
 2. Make a backup copy of /etc/postfix/main.cf 2. Make a backup copy of /etc/postfix/main.cf
Line 15: Line 31:
 relayhost = [smtp.gmail.com]:587 relayhost = [smtp.gmail.com]:587
  
- use tls+# use tls
 smtp_use_tls=yes smtp_use_tls=yes
  
Line 58: Line 74:
  
 8. Restart postfix: \\ 8. Restart postfix: \\
 +<code>
 +# /bin/systemctl restart postfix.service
 +</code>
 +or
 <code> <code>
 # /etc/init.d/postfix reload # /etc/init.d/postfix reload
Line 72: Line 92:
 #set from = username@HOSTNAME_OR_ALIAS.domain #set from = username@HOSTNAME_OR_ALIAS.domain
 #set realname="juckins@lightning" #set realname="juckins@lightning"
-set realname=$USER@$HOSTNAME+set realname="$USER@$HOSTNAME" (works in CENTOS7, mutt-1.5.21-26.el7.x86_64 but *not* via cron sending) 
 </code> </code>
  
Line 79: Line 100:
 mutt -s "Test1" [email protected] </dev/null mutt -s "Test1" [email protected] </dev/null
 </code> </code>
-or+or to send a message without using a separate file:
 <code> <code>
 echo 'It works' | mailx -s 'Test message' [email protected] echo 'It works' | mailx -s 'Test message' [email protected]
gmail_as_a_relay_on_linux.txt · Last modified: 2024/01/01 12:40 by juckins