• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to Setup Catch-All Email Account in Postfix

Written by Rahul, Updated on May 14, 2020

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.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

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.

Share it!
Share on Facebook
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on Tumblr
Share on Whatsapp
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

9 Comments

  1. Avatar EnduraMax Reviews Reply
    May 5, 2019 at 7:38 pm

    Greetings! Very useful advice within this post!
    It’s the little changes that produce the biggest changes.

    Thanks a lot for sharing!

  2. Avatar Andres Reply
    October 26, 2018 at 2:04 am

    Hey, it’s been four years and this is still helping people, thanks so much, just right to the point.

  3. Avatar Andy Collins Reply
    January 4, 2016 at 9:51 am

    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.

  4. Avatar Miky Reply
    January 3, 2016 at 7:44 pm

    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?

  5. Avatar Mateo Reply
    November 25, 2015 at 1:00 am

    So the catchall needs to be in the first line, but what if I have several virtual domains? one file per domain? help plz 🙁

  6. Avatar sham Reply
    September 13, 2015 at 12:38 pm

    It worked for me.

  7. Avatar Kirby Reply
    May 4, 2015 at 12:53 pm

    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?

  8. Avatar thankssssss Reply
    October 12, 2014 at 12:35 am

    Thank you!!! Couldn’t get this to work until I saw you needed “postmap /etc/postfix/virtual”

    Thanks again!

  9. Avatar Andy Collins Reply
    October 3, 2013 at 6:58 pm

    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!

Leave a Reply Cancel reply

Popular Posts

  • How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 32/31 0
  • How To Install VNC Server on Ubuntu 20.04 1
  • How To Install NVM on macOS with Homebrew 0
  • (Solved) apt-add-repository command not found – Ubuntu & Debian 0
  • How to Install .NET Core on Debian 10 0
© 2013-2020 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy