By James Cooley - December 14 2006 tags: postfix linux

I should know better than to spend time trying to configure a mail server but I wanted to get mail from all my diffrent domains sent to my gmail account in the style of ZoneEdit MailForwardâ„¢ and I couldn't let it go.

I got it working after lots of testing. If you want to forward from you need to change your to

virtual_alias_domains =
virtual_alias_maps = hash:/etc/postfix/virtual
# Ubuntu sets this to loopback-only [thanks to synergy of loxal blog for Ubuntu Feisty details]
#inet_interfaces = loopback-only
# default on Fedora - change to all for Ubuntu
inet_interfaces = all
Say I have an account on the box with the user james. Then I created a file with
#/etc/postfix/virtual james
# uncomment this to send all mail (spam) to your account james

To get postfix to pick up my changes I used
cd /etc/postfix
sudo /usr/sbin/postmap virtual
sudo /sbin/service postfix restart

If you have problems getting it to forward to other domians you could try to set your virtual alias to a local account and use ~/.forward [remember to "chmod 0640 ~/.forward"] to get it to work.

If you want some background I found the Red Hat Postfix HOWTO useful.

UPDATE: Have a look at synergy of loxal blog for Ubuntu Feisty details.