How to redirect local root mail to an email address with Postfix

After you install postfix, then you may wnat to have root’s email sent to a real email address. This will help to send cron jobs to you.

Edit the /etc/aliases file and add your username and external email address.


# root: youremailaddress@domain.com

Now run this command:-


# newaliases

Now restart Postfix:-


# service postfix restart

and to test, run the following command:-


# echo test | mail -s "test message" root