Catch-All email account is used to collect all emails send to any email of a domain. Its help us to avoid loosing of emails due to misspelled addresses. While using catch-all address you may receive spam messages, and many bounces messages that sent to any-mail (at) your-domain.com .
This Tutorial will help you to setup catch-all email address with postfix server.
Step 1 – Setup Catch-All Account
A catch-all account can be created by adding a virtual aliases to the postfix server. To add an alias edit /etc/postfix/virtual configuration file:
vim /etc/postfix/virtual
Then add a catch-all address like below:
@example.com myuser
You may also have some actual email accounts on your domain and you need to forward emails of that accounts to correct mailbox. Then you can also create virtual alias for that email address and forward to specific users mailboxes. Use the below configuration, which will send all emails to user “myuser” except emails of [email protected] and [email protected]
@example.commyuser [email protected]info [email protected]support
Save and close configuration file, then execute the following command to create or update hash file.
postmap /etc/postfix/virtual
Step 2 – Update Postfix Configuration File
Now, you need to add virtual_alias_maps to the Postfix main configuration file. Just edit Postfix configuration file /etc/postfix/main.cf in your favorite text editor:
vim /etc/postfix/main.cf
Add following entry to the end of file
virtual_alias_maps = hash:/etc/postfix/virtual
Step 3 – Reload Postfix Server
After making all the changes, reload postfix service to apply all settings. Use the following command to reload postfix configuration.
systemctl reload postfix
You have completed postfix catch-all email setting configuration. Click here to read more about catch all account.
Greetings! Very useful advice within this post!
It’s the little changes that produce the biggest changes.
Thanks a lot for sharing!
Hey, it’s been four years and this is still helping people, thanks so much, just right to the point.
Mateo/Miky.
I have multiple virtual domains in Mail Server/Postfix on my Synology and what I found was if you added multiple catch-alls in Virtual then all the caught mail would just go to one domain. How I got around this was within the Synology interface, where you enter your list of domains, the first/primary domain needs to be anything other than your actual domains, so for instance mylocalmail.com. You then add all your other domains after this one. (Sorry I can’t remember what file this is actually editing within Linux). You can then add as many @domain.com entries to virtual as you like. They don’t even need to be the first line in Virtual.
Thanks, It works like a charm. However, I am have multiple virtual domains on my server. The above instructions work for the main domain (example.com) hosted on the server. How can I set up catch-all for all of the hosted domains and users?
So the catchall needs to be in the first line, but what if I have several virtual domains? one file per domain? help plz 🙁
It worked for me.
Hi,
Thanks for this article. But you know, I didn’t find a place where I could find caught emails. Could you write where is it?
Thank you!!! Couldn’t get this to work until I saw you needed “postmap /etc/postfix/virtual”
Thanks again!
Thank you for this guide. It’s the only one I’ve found which says that the catch-all line needs to be the first line in virtual. Even Postfix’s documentation has it at the end of the list. I’ve already wasted several hours on trying to get the catch-all to work properly, so thank-you for stopping from wasting even more!