- Log in to post comments
# install
sudo apt-get install -y mailx
# configure postfix
postconf -e 'smtp_generic_maps = hash:/etc/postfix/generic'
cat <> /etc/postfix/generic
root@ubuntu.example.local info@example.com
EOF
service postfix restart
postmap /etc/postfix/generic
# configure smtp
cat < ~/.mailrc
set from="YOU@YOUR_MAIL.COM"
set smtp="YOUR_SMTP_SERVER"
set smtp-auth-user="SMTP_USER"
set smtp-auth-password="SMTP_PASS"
EOF
# test
echo "This is a test message from ${USER}@${HOSTNAME} at $(date)" | mail -s "Test email" YOU@YOUR_MAIL.COM
# v2
sudo apt-get install nullmailer