All technological notes.
postfix on Redhat8su - root
# install package
yum install -y postfix mailx
# # verify
rpm -qa | grep postfix
rpm -qa | grep mailx
vi /etc/postfix/sasl/sasl_passwd
[smtp.gmail.com]:587 email@gmail.com:password
postmap /etc/postfix/sasl/sasl_passwd
ll /etc/postfix/sasl
# -rw-r--r--. 1 root root 58 Nov 22 00:20 sasl_passwd
# -rw-r--r--. 1 root root 12288 Nov 22 00:22 sasl_passwd.db
# change ownership
chown root:root /etc/postfix/sasl/sasl_passwd
# limited only the root user can read and write the credential file
chmod 600 /etc/postfix/sasl/*
ll /etc/postfix/sasl/*
# -rw-------. 1 root root 58 Nov 22 00:20 /etc/postfix/sasl/sasl_passwd
# -rw-------. 1 root root 12288 Nov 22 00:22 /etc/postfix/sasl/sasl_passwd.db
Postfix Configuration/etc/postfix/main.cfcp /etc/postfix/main.cf /etc/postfix/main.cf_bkp
vi /etc/postfix/main.cf
# configure relay host
relayhost = [smtp.gmail.com]:587
# configure hostname
myhostname = rhelhost.localdomain
# specify location of sasl_passwd file
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
# Enable SASL authentication for postfix
smtp_sasl_auth_enable = yes
smtp_tls_security_level = encrypt
# Prevent anonymous authentication
smtp_sasl_security_options = noanonymous
Postfix servicesystemctl enable postfix.service
systemctl start postfix.service
systemctl status postfix.service
echo "Test Mail" | mail -s "Postfix Test" target@gmail

# create a text file
vi /home/rheladmin/note.txt
# Hello world
echo "Test Mail" | mail -s "Postfix Test" -a /home/rheladmin/note.txt target@gmail
vi /etc/cron.hourly/auto-email
# * * * * * echo "Test Auto Email." | mail -s "Test Auto Email - $(date)" target@gmail
crontab -l /etc/cron.hourly/auto-email
