Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Mail Services»How to Setup Catch-All Email Account in Postfix

    How to Setup Catch-All Email Account in Postfix

    RahulBy RahulJuly 12, 20142 Mins ReadUpdated:July 1, 2021

    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.

    catch-all catchall Email mailbox Postfix
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleVirtual Learning Online Home School – Why ?
    Next Article Install Ruby 1.9.3 ( or Multiple Ruby Version ) on CentOS, RedHat using RVM

    Related Posts

    How to Install and Configure Postfix on Ubuntu 20.04

    5 Mins Read

    How to Install Roundcube Webmail on Ubuntu 20.04

    5 Mins Read

    Postfix Forward Incoming Emails to Other Email Account

    Updated:April 5, 20222 Mins Read

    How to Install Dovecot on Ubuntu 20.04

    Updated:July 22, 20213 Mins Read

    How to Install Roundcube Webmail on CentOS 8

    Updated:June 14, 20215 Mins Read

    How to Install Roundcube Webmail on CentOS 7

    Updated:May 2, 20205 Mins Read

    11 Comments

    1. kuchenman on July 6, 2021 8:53 am

      On newer versions of postfix (like mail_version = 3.4.14) you should not forget the postmap command.
      Just writing into file “virtual” will not solve the issue.
      You’ll have to create “virtual.db” with postmap command.
      sudo postmap virtual
      sudo systemctl restart postfix

      Reply
    2. Ramze Jarad on June 30, 2021 9:29 pm

      2021 and it help me
      thank you

      Reply
    3. EnduraMax Reviews on May 5, 2019 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!

      Reply
    4. Andres on October 26, 2018 2:04 am

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

      Reply
    5. Andy Collins on January 4, 2016 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.

      Reply
    6. Miky on January 3, 2016 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?

      Reply
    7. Mateo on November 25, 2015 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 🙁

      Reply
    8. sham on September 13, 2015 12:38 pm

      It worked for me.

      Reply
    9. Kirby on May 4, 2015 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?

      Reply
    10. thankssssss on October 12, 2014 12:35 am

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

      Thanks again!

      Reply
    11. Andy Collins on October 3, 2013 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!

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How to run “npm start” through docker
    • Filesystem Hierarchy Structure (FHS) in Linux
    • How to accept user input in Python
    • What is difference between var, let and const in JavaScript?
    • What is CPU? – Definition, Types and Parts
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.