Quick way to forward mails via postfix
Assuming you’re running Postfix, first we make sure the virtual mappings file is enabled here /etc/postfix/virtual
:
# Scroll down until you find virtual_alias_maps, make sure it reads something like
virtual_alias_maps = hash:/etc/postfix/virtual
# We also need to make sure the domain is enabled
virtual_alias_domains=example.com
Save and exit. Next we add the aliases to our mapping file /etc/postfix/virtual
:
# Forward mail for admin@example.com to jo.bloggs@hotmail.com
admin@example.com jo.bloggs@hotmail.com
If we want to send to two different addresses at once, we specify:
admin@example.com jo.bloggs@hotmail.com jos.wife@hotmail.com
Finally, we need to create a hash (later versions of Postfix don’t require this)
postmap /etc/postfix/virtual
It’s the same principle as passing mail into a local user’s mailbox.
Hey! I'll happily receive your comments via email
![](/assets/img/avatar.jpg)
Andreas Wagner
Freelance System Administrator from Tallinn, Estonia.