gmail_as_a_relay_on_linux
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
gmail_as_a_relay_on_linux [2015/11/04 18:41] – juckins | gmail_as_a_relay_on_linux [2023/06/23 10:43] – juckins | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | Directions [[http:// | + | ===== Using Gmail as a Relay on CentOS Linux ===== |
- | 1A. Make sure /etc/ssmtp/ssmtp.conf is the distro version | + | 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# | ||
+ | * cyrus-sasl-lib | ||
- | 1B. Make a backup copy of /etc/postfix/main.cf | + | Other CentOS 7 Notes: |
+ | * Best to use this version | ||
+ | * Otherwise, you may get errors like: Bad IDN in " | ||
+ | * /etc/resolv.conf may need the ' | ||
+ | * As root, run ' | ||
+ | * If trouble sending after install, may need to consult [[http://unix.stackexchange.com/ | ||
- | 2. Edit / | + | CentOS 8 Notes: |
+ | * (Nothing special noted) | ||
+ | |||
+ | RockyLinux 9 Notes: | ||
+ | * ? | ||
+ | |||
+ | Directions [[http:// | ||
+ | |||
+ | 1. If it exists, make sure / | ||
+ | |||
+ | 2. Make a backup copy of / | ||
+ | |||
+ | 3. Edit / | ||
< | < | ||
- | # sets gmail as relay | + | # Sets gmail as relay |
relayhost = [smtp.gmail.com]: | relayhost = [smtp.gmail.com]: | ||
- | # | + | # Use tls |
smtp_use_tls=yes | smtp_use_tls=yes | ||
- | # use sasl when authenticating to foreign SMTP servers | + | # Use sasl when authenticating to foreign SMTP servers |
smtp_sasl_auth_enable = yes | smtp_sasl_auth_enable = yes | ||
- | # path to password map file | + | # Path to password map file |
smtp_sasl_password_maps = hash:/ | smtp_sasl_password_maps = hash:/ | ||
+ | # NOTE: This section *should* be configured properly in CentOS8 and RockyLinux9 by default | ||
# list of CAs to trust when verifying server certificate | # list of CAs to trust when verifying server certificate | ||
# | # | ||
Line 25: | Line 48: | ||
smtp_tls_CAfile = / | smtp_tls_CAfile = / | ||
- | # eliminates | + | # Eliminates |
smtp_sasl_security_options = | smtp_sasl_security_options = | ||
- | # add debugging | + | # Modify |
debug_peer_list=smtp.gmail.com | debug_peer_list=smtp.gmail.com | ||
debug_peer_level=3 | debug_peer_level=3 | ||
</ | </ | ||
- | 2. Add your own Gmail credentials to / | + | 4. Add your own Gmail credentials to / |
< | < | ||
[smtp.gmail.com]: | [smtp.gmail.com]: | ||
</ | </ | ||
- | 3. Run the following as root: \\ | + | 5. Run the following as root: \\ |
< | < | ||
# postmap / | # postmap / | ||
</ | </ | ||
- | 4. Make sure the / | + | 6. Make sure the / |
< | < | ||
# chown postfix sasl_passwd* | # chown postfix sasl_passwd* | ||
</ | </ | ||
- | 5. Tighten permissions: | + | 7. Tighten permissions: |
< | < | ||
# chmod 600 sasl_passwd sasl_passwd.db | # chmod 600 sasl_passwd sasl_passwd.db | ||
</ | </ | ||
- | 6. Restart postfix: \\ | + | 8. Restart postfix: \\ |
+ | < | ||
+ | # / | ||
+ | </ | ||
+ | or | ||
< | < | ||
# / | # / | ||
Line 62: | Line 89: | ||
</ | </ | ||
- | 7. Send a test message: \\ | + | 9. Add these lines to the global / |
< | < | ||
- | echo 'It works' | mailx -s 'Test message' | + | set from = " |
+ | set realname = " | ||
</ | </ | ||
- | 8. Edit ~/ | + | 10. Send a test message: \\ |
+ | < | ||
+ | mutt -s " | ||
+ | </ | ||
+ | or to send a message without using a separate file but note mailx is probably not looking at .muttrc: | ||
+ | < | ||
+ | echo 'It works' | mailx -s 'Test message' | ||
+ | </ | ||
+ | or | ||
< | < | ||
- | #set from = $USER@$HOSTNAME | + | mailx -a test.txt -s "test subject" |
- | #set from = username@HOSTNAME_OR_ALIAS.domain | + | |
- | #set realname="juckins@lightning" | + | |
- | set realname=$USER@$HOSTNAME | + | |
</ | </ | ||
gmail_as_a_relay_on_linux.txt · Last modified: 2024/01/01 12:40 by juckins