forward emails to non existing accounts to one central one in Postfix

Posted August 6, 2019 5.1k views
SecurityEmailMessagingSolutionsInitial Server Setup

Hey guys,

I have a (Linux) server running with Postfix as an email server. When registering to a new site I do not want to use a single mail twice so when my email gets leaked by a security breach at any site only this one mail get published in lists to the internet, but because I only used it on that site it would be useless. By this meaning, I would always have to create a new email user whenever I sign up to a site and I would also have to enable email forwarding to the “main” email (having a ton of addresses is not an option). As I am lazy I do not want to do this so I am looking for a way to automatic forward emails to a specified account when the recipient’s email would be on my server but does not exist.

best regards Thore

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi ThoreTheWookie,

What you are looking for is setting up a catchall mailbox.

With a catchall mailbox, all your e-mails will be redirected to one account. Some websites send confirmation e-mail messages to the e-mail account you use to register. In this case, using a catchall would be the best option.

Let’s set a catchall Postfix mailbox then

  • Edit /etc/postfix/virtual and configure your catch-all address like below. myuser
  • Let’s say you don’t want all mails to be forwarded to this catchall mailbox. You can add exceptions so that you can use the accounts normally.Add them also in /etc/postfix/virtual file. The below configuration will send all emails to user “myuser” except emails of and myuser  info support
  • Save /etc/postfix/virtual file and execute the following command.
postmap /etc/postfix/virtual
  • Now to update the Postfix’s configuration file - /etc/postfix/
virtual_alias_maps = hash:/etc/postfix/virtual
  • After the change has been saved, you’ll need to reload the Postfix configuration. To do so, execute:
service postfix reload

Now you have a catchall mailbox configured.

Kind regards,
Kalin D.