How to Setup Catch-All Email Account in Postfix

Channel: Linux
Abstract: Catch-All email account is used to collect all emails sent to any email of a domain. It helps us to avoid losing emails due to misspelled addresses. W

Catch-All email account is used to collect all emails sent to any email of a domain. It helps us to avoid losing emails due to misspelled addresses. While using the catch-all address you may receive spam messages and many other bounce messages that sent to any-email (at) your-domain.com.

This tutorial will help you to set up a catch-all email address with a 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:

nano /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 the correct mailbox. Then you can also create virtual alias for that email address and forward it to specific user’s mailboxes. Use the below configuration, which will send all emails to user 「myuser」 except emails of [email protected] and [email protected]

@example.com myuser
[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

The above command will create /etc/postfix/virtual.db file in your system. Which will be used by the Postfix server.

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:

nano /etc/postfix/main.cf

Add the following entry to the end of the file

virtual_alias_maps = hash:/etc/postfix/virtual

Save the file and close it.

Step 3 – Reload Postfix Server

After making all the changes, reload the postfix service to apply all settings. Use the following command to reload the postfix configuration.

systemctl reload postfix

You have completed postfix catch-all email setting configuration. Click here to read more about catch all account.

Ref From: tecadmin

Related articles