Getting postfix to forward mail from virtual domains
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 example.com you need to change your main.cf to
#/etc/postfix/main.cfSay I have an account on the box with the user james. Then I created a file with
virtual_alias_domains = example.com
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
# uncomment this to send all mail (spam) to your account
To get postfix to pick up my changes I used
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.