If you want to forward system emails to a real email address:
Run all commands as sudo -i
Replace email@example.com with your destination email.
Run all commands as sudo -i
Replace email@example.com with your destination email.
- Install Sebndmail:
sudo apt-get install sendmail - Make sure the last line of /etc/aliases is: root: email@example.com
vi /etc/aliases - Get the hostname:
hostname - Add the hostname to genericsdomain
cd /etc/mail
vi genericsdomain - Map your local user name to recipient email e.g.:
vi genericstable
[username]@[hostname] email@example.com - Add your username as a trusted user:
vi trusted-users
[username] - To prevent long DNS timeouts each time sendmail restarts or tries to send an email add "localhost.localdomain " to # localhost, for example:
vi /etc/hosts
127.0.0.1 localhost localhost.localdomain [hostname] - Edit sendmail to add before the line "MAILER_DEFINITIONS":
vi sendmail.mc
dnl #
MASQUERADE_AS(`email@example.com')
dnl FEATURE(`allmasquerade')
dnl FEATURE(`masquerade_envelope')
dnl # - Rebuild and reload the sendmail config:
sendmailconfig
/etc/init.d/sendmail reload sendmailconfig - Now you should be able to email yourself:
apt install mailutils
echo "test" | mail --debug-level=15 -s "test email" email@example.com
No comments:
Post a Comment