Main Contents

Redirect root mail to an external e-mail address

July 29, 2008

This uses postfix, my mail transport of choice.

Configure /etc/postfix/main.cf as below. (If you already have a local MTA running, skip this section.) Also, this allows any other mail to be sent from your box, not just for root.

myhostname = host.domain.tld
mydomain = domain.tld
myorigin = $myhostname
inet_interfaces = localhost
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks = 127.0.0.0/8
relayhost = [your.mail.server.ipaddress]

Add this line to the bottom of /etc/aliases:

root: your_email@domain.com

Run this command:

newaliases

Restart postfix and use this to test:

echo test | mail -s "test message" root

Filed under: Linux |

1 Comment

  1. guest March 8, 2009 @ 5:29 am

    thanks!