I am running Centos 5 with Parallels Plesk Panel 10.3.1. My MTA is Postfix. I was looking for some solution to forward all the mails for user root to some external email address. Follow these steps at your own risk to achieve this.
Plesk stores the mail aliases database in /var/spool/postfix/plesk/aliases.db file. If this is the first time you are browsing the folder /var/spool/postfix/plesk then you will not find the file named aliases but instead you will find aliases.db file. These db files are binary files so you need to have some tool to decode this file to text format ; make the changes in the text file and convert it back to the database file.
Go to /var/spool/postfix/plesk/ folder and issue the following command to convert the aliases.db file to text format. Here, you don’t have to specify aliases file with .db extension.
# postmap –s aliases > aliases
Now edit /var/spool/postfix/plesk/aliases file and make the appropriate change to forward mails for root to the external email address. This file will look like below:
postmaster abc@example.com
root def@example.com
mailer-daemon abc@example.com
anonymous abc@example.com
mailman abc@example.com
After making the necessary changes, save the aliases file. Now you need to convert the text file aliases to aliases.db file. Stay in the folder /var/spool/postfix/plesk and issue the following command to do so.
# postmap hash:aliases
Now, that the aliases.db file has been generated, you need to tell postfix daemon to reload the configuration. Issue the following command:
# postfix reload
Trigger an email to xyz@localhost.localdomain and check if it has been forwarded to def@example.com.