Postfix is an open source mail transfer agent (MTA), for the routing and delivery of email. This post examples how to forward an email to another local or remote email user using Postfix MTA.
It provides a method of redirect mail to another user for both local and remote users. You need to configure /etc/postfix/aliases (or use /etc/aliases) file. The aliases file (read as table) provides a system-wide mechanism to redirect mail for local recipients. The redirections are processed by the Postfix local delivery agent.
Normally, the aliases table is specified as a text file that serves as input to the postalias command. The result, an indexed file in dbm or db format, is used for fast lookup by the mail system. Execute the command newaliases in order to rebuild the indexed file after changing the Postfix alias database.
Open file /etc/postfix/aliases using vi text editor:
# vi /etc/postfix/aliases
Now add line as follows:
abuse: noc@isp.com, bob@isp.com, techgroup@isp.com, postmaster
Save and close the file. The abuse name is the local address which be receiving the mail on the local machine. noc@isp.com is the email address on another domain to forward to (the value can be a username on the local machine or the email address). This can be a single or multiple values separated by commas.
To redirect root email to tom user:
root: tom
Or
root: tom@example.com
Type newaliases command to build new database:
# newaliases
To troublshoot problem further see postfix server log file:
# tail -f /var/log/mailog
Sample outputs
Jan 8 03:56:33 www330 postfix[13209]: p089uXvh013209: from=root, size=29, class=0, nrcpts=1, msgid=<201101080956.p089uXvh013209@www330.nixcraft.net.in>, relay=root@localhost Jan 8 03:56:33 www330 postfix[13210]: p089uXZH013210: from=, size=337, class=0, nrcpts=1, msgid=<201101080956.p089uXvh013209@www330.nixcraft.net.in>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1] Jan 8 03:56:33 www330 postfix[13209]: p089uXvh013209: to=root, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30029, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (p089uXZH013210 Message accepted for delivery) Jan 8 03:56:34 www330 postfix[13211]: STARTTLS=client, relay=cyberciti.biz.s9a1.psmtp.com., version=TLSv1/SSLv3, verify=FAIL, cipher=AES256-SHA, bits=256/256 Jan 8 03:56:36 www330 postfix[13211]: p089uXZH013210: to=vivek@nixcraft.net, ctladdr= (0/0), delay=00:00:03, xdelay=00:00:03, mailer=esmtp, pri=30576, relay=cyberciti.biz.s9a1.psmtp.com. [202.xxx.yyy.zzz], dsn=2.0.0, stat=Sent (Thanks)
The above output indicates that mail sent to local root account is forwarded to vivek@nixcraft.net via smtp server called cyberciti.biz.s9a1.psmtp.com. If you do not have admin access to the mail server, use the .forward file from your own home directory to forward an email to another account.
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins

- My 10 UNIX Command Line Mistakes
- 25 PHP Security Best Practices For Sys Admins
- The Novice Guide To Buying A Linux Laptop
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
Facebook it - Tweet it - Print it -
We're here to help you make the most of sysadmin work. So, subscribe!


{ 2 comments… read them below or add one }
Hi Vivek !
Nice article! That’s what i’m looking for!
But the last link … .forward … is broken. Could you fix it, please?
Done! Hope this helps!