Do you want to catch-all emails in postfix? Does missing emails due to misspelling addresses bothered you? Then this article is for you.
A catch-all email account is used to get all emails sent from every email account of your domain. No matter that email account exists or someone misspelled that email. Catch-all is usually used when you do not want to lose any email due to the wrong email address or email that did not exist.
Here we discuss all steps that are needed to set up a catch-all email account in Postfix.
Follow along so you can easily setup and never miss any Email.
Create Catch All Account:
The first step is to create a catch-all account where you will receive all emails. Which are lost due to misspelling or non existing email?
To do so you have to add a virtual alias to the Postfix server. The path of file where you have to add the alias is /etc/postfix/virtual.
You have to edit this file in your favorite Editor I chose vi editor. Use this command to edit the file.
Now add the address for catch-all at the end of this file. Add the address like:
You can also specify any email account where you want to catch-all emails. You can specify different email account for this operation also. like:
Support@example.com Support@example.com email@example.com firstname.lastname@example.org email@example.com firstname.lastname@example.org
If you didn’t specify the valid account then your valid account’s email will also go to that specific email you specify for catch-all. This account helps to Catch-all email that you miss due to non existing account or misspelled email addresses.
After adding these Alias to /etc/postfix/virtual save and exit.
After this we have to run a command to execute this file again.
Now your updated file is loaded shift to next step.
Setup Postfix Configuration:
After editing the virtual file now its time to do some configurations in the postfix configuration file. In order to do this go to the file etc/postfix/main.cf. Edit this file in vi or any other editor you like. for vi use this command:
you have to add virtual_alias_maps in this file add this line at the end of this main.cf file:
virtual_alias_maps = hash:/etc/postfix/virtual
Reload Postfix for new settings:
Now Postfix needs to reload so it can fetch the new settings. To reload postfix run the command:
systemctl reload postfix
Now all done good to go.