inGuide | Digital Marketing, Online Business & WordPress
  • Home
  • Blog
  • Deals
  • Services
  • Forum
    • New Forum
  • Free Resources
    • inSend: Mailwizz
  • Contact
  • Click to open the search input field Click to open the search input field Search
  • Menu Menu
Email Marketing, SMTP server

Install and Configure MailCow – Best Self Hosted Mail Server

Though there are several mailing solution for self hosted mail server, but installation and configuration can be headache some times. MailCow is fully feature loaded mailing script based on Dovecot, Postfix, SoGo and other open source software. It’s not easy to install, but also provides a modern web user interface for user and server administration.

MailCow is open source project which means you don’t have to spend a penny from your pocket for the software. To learn more about MailCow you can read their official documentation.

Requirement for MailCow Server

  • A domain name
  • A VPS or Cloud with a Minimum of 6 GB RAM

I will using Contabo for demonstration as they do not ban port 25. I have prepared list of VPS provider which gives you open port 25.

  • Recommended OS: Ubuntu 20.04

Initial DNS Setup

First of all you need to create few DNS records in order to start. They are as follows

TypeHostValue
AmailYour IP address
CNAMEautodiscovermail.yourdomain.com
CNAMEautoconfigmail.yourdomain.com
MX@mail.yourdomain.com 10

Installation of MailCow

Before, you can actually install mailcow, you need to install docker and docker compose needed by mailcow.

Installation of Docker

I already have discussed installation of Docker on Ubuntu. All, you need is to follow that article to install docker and docker-compose, which is will also help you understand docker.

Install MailCow

First of all set the hostname

root@mail:~# hostnamectl set-hostname mail.yourdomain.com

Then install git , just in case it’s not installed. Then change working directory to opt directory and pull MailCow files from github.

root@mail:~# apt install git -y
root@mail:~# cd /opt
root@mail:/opt# git clone https://github.com/mailcow/mailcow-dockerized

Now again change working directory.

root@mail:/opt# cd mailcow-dockerized

Finally execute the bin file and answer the question

root@mail:/opt/mailcow-dockerized# ./generate_config.sh

Press enter to confirm the detected value '[value]' where applicable or enter a custom value.
Mail server hostname (FQDN) - this is not your mail domain, but your mail servers hostname: mail.ingu.pw
Timezone [Etc/UTC]:
Generating snake-oil certificate...
Generating a RSA private key
...................................................................++++
...............................................................................................................................................................................................++++
writing new private key to 'data/assets/ssl-example/key.pem'
-----
Copying snake-oil certificate...

You can also make changes in configuration of you like

root@mail:/opt/mailcow-dockerized# nano mailcow.conf

Next, pull MailCow docker image

root@mail:/opt/mailcow-dockerized# docker-compose pull

Pulling unbound-mailcow   ... done
Pulling mysql-mailcow     ... done
Pulling redis-mailcow     ... done
Pulling clamd-mailcow     ... done
Pulling php-fpm-mailcow   ... done
Pulling sogo-mailcow      ... done
Pulling dovecot-mailcow   ... done
Pulling rspamd-mailcow    ... done
Pulling postfix-mailcow   ... done
Pulling memcached-mailcow ... done
Pulling nginx-mailcow     ... done
Pulling acme-mailcow      ... done
Pulling netfilter-mailcow ... done
Pulling watchdog-mailcow  ... done
Pulling dockerapi-mailcow ... done
Pulling solr-mailcow      ... done
Pulling olefy-mailcow     ... done
Pulling ejabberd-mailcow  ... done
Pulling ofelia-mailcow    ... done
Pulling ipv6nat-mailcow   ... done

Finally, run the compose.

root@mail:/opt/mailcow-dockerized# docker-compose up -d

Creating network "mailcowdockerized_mailcow-network" with driver "bridge"
Creating volume "mailcowdockerized_vmail-vol-1" with default driver
Creating volume "mailcowdockerized_vmail-index-vol-1" with default driver
Creating volume "mailcowdockerized_mysql-vol-1" with default driver
Creating volume "mailcowdockerized_mysql-socket-vol-1" with default driver
Creating volume "mailcowdockerized_redis-vol-1" with default driver
Creating volume "mailcowdockerized_rspamd-vol-1" with default driver
Creating volume "mailcowdockerized_solr-vol-1" with default driver
Creating volume "mailcowdockerized_postfix-vol-1" with default driver
Creating volume "mailcowdockerized_crypt-vol-1" with default driver
Creating volume "mailcowdockerized_sogo-web-vol-1" with default driver
Creating volume "mailcowdockerized_sogo-userdata-backup-vol-1" with default driver
Creating volume "mailcowdockerized_xmpp-vol-1" with default driver
Creating volume "mailcowdockerized_xmpp-upload-vol-1" with default driver
Creating mailcowdockerized_sogo-mailcow_1      ... done
Creating mailcowdockerized_olefy-mailcow_1     ... done
Creating mailcowdockerized_memcached-mailcow_1 ... done
Creating mailcowdockerized_clamd-mailcow_1     ... done
Creating mailcowdockerized_unbound-mailcow_1   ... done
Creating mailcowdockerized_watchdog-mailcow_1  ... done
Creating mailcowdockerized_dockerapi-mailcow_1 ... done
Creating mailcowdockerized_solr-mailcow_1      ... done
Creating mailcowdockerized_ejabberd-mailcow_1  ... done
Creating mailcowdockerized_redis-mailcow_1     ... done
Creating mailcowdockerized_mysql-mailcow_1     ... done
Creating mailcowdockerized_php-fpm-mailcow_1   ... done
Creating mailcowdockerized_postfix-mailcow_1   ... done
Creating mailcowdockerized_dovecot-mailcow_1   ... done
Creating mailcowdockerized_nginx-mailcow_1     ... done
Creating mailcowdockerized_ofelia-mailcow_1    ... done
Creating mailcowdockerized_netfilter-mailcow_1 ... done
Creating mailcowdockerized_rspamd-mailcow_1    ... done
Creating mailcowdockerized_acme-mailcow_1      ... done
Creating mailcowdockerized_ipv6nat-mailcow_1   ... done

You might have to open port if firewall is running on your server. Run the following commands

root@mail:~# sudo ufw allow 25,80,443,110,143,465,587,993,995/tcp

Now go to browser and open https://mail.yourdomain.com with the default credentials admin + password moohoo.

mailcow-admin-login-window

Inside admin dashboard make sure to change the password.

mailcow-admin-dashboard

To add domain and user go to configuration in the top menu

mailcow-add-domain-mail-window

To access mailbox go to https://mail.yourdomain.com/sogo and enter username and password.

mailcow-webmail-login

Next screen will be something like this.

mailcow-webmail-dashboard

Final DNS Configuration

You also need to setup DKIM, DMARC and SPF record to finish the installation.

TypeHostValue
TXT@“v=spf1 mx a -all”
TXT_dmarc“v=DMARC1; p=reject; rua=mailto:[email protected]”
TXTdkim._domainkey“v=DKIM1; k=rsa; t=s; s=email; p=…”

To get the DKIM go to configuration>>domain>>edit as follows

add-dkim-mailcow

At the bottom of next page, you should find DKIM key. Copy it and paste it in DKIM TXT record.

dkim-key-mailcow-location

Conclusion

Installation of MailCow mail server is simple and with proper guidance any one can install it. In this tutorial, I have demonstrated all the steps and commands required to install MailCow.

May 12, 2021/12 Comments/by Dhiraj Rahul
Tags: install docker ubuntu, install mailcow, mailcow
Share this entry
  • Share on Facebook
  • Share on X
  • Share on WhatsApp
  • Share on Pinterest
  • Share on LinkedIn
  • Share on Tumblr
  • Share on Vk
  • Share on Reddit
  • Share by Mail
https://inguide.in/wp-content/uploads/2021/02/inguide_logo_red_340_156-300x138.png 0 0 Dhiraj Rahul https://inguide.in/wp-content/uploads/2021/02/inguide_logo_red_340_156-300x138.png Dhiraj Rahul2021-05-12 10:32:342021-05-21 08:01:07Install and Configure MailCow – Best Self Hosted Mail Server
12 replies
  1. Eros
    Eros says:
    August 13, 2021 at 3:40 am

    Hello,
    First congratulation for your tutorial.
    I have installed a mail server (mailcow app) on ubuntu and I am confused about reverse dns (PTR record). I’ll tell you the facts:
    We will take king-kong.com as an example
    Main domain name -> king-kong.com
    subdomain: mail.king-kong.com
    mailcow app -> sogo -> domain: trace.king-kong.com
    So users use [email protected] as their email address.
    Namecheap.com setup:
    A Record: mail
    CNAME Record: mail.king-kong.com
    TXT Record: … p = reject; rua = mailto: [email protected]

    What I would like to know is what domain name I should use for the PTR record? mail.king-kong.com or trace.king-kong.com

    Reply
    • Numan
      Numan says:
      October 29, 2021 at 7:31 pm

      Type: PTR
      Name: 1.2..3.4.in-addr.arpa <—- chnage to ipv4 address of your mail server 1.2.3.4
      Domain Name: mail.king-kong.com

      Reply
  2. Lonnie
    Lonnie says:
    June 25, 2022 at 2:53 pm

    Hello,

    I have a server and am migrating away from Google with multiple domains that I have which provide different email accounts on their server. I need to see how to get Mailcow to receive from different domains.

    I use Godaddy and have set up both domains with their different A, CNAME, MX, and TXT records after creating a second domain on my Mailcow instance but I do not seem to get email from the second domain. Also, I pointed both DNA “A” records to the same IP.

    Can you please advise?

    Reply
    • Dhiraj Rahul
      Dhiraj Rahul says:
      June 28, 2022 at 3:37 pm

      Go with Zimbra.

      Reply
  3. moki rikta
    moki rikta says:
    August 9, 2022 at 2:28 am

    I had follow your guide line but only can send only the same domain .it can not send out to other domain.
    What i am wrong in configuration.? i always see this when sent out email.
    connect to reception.mail-tester.com[94.23.206.89]:25: Connection timed out
    What should i do.?Any recommend.!

    Reply
    • Dhiraj Rahul
      Dhiraj Rahul says:
      August 9, 2022 at 12:01 pm

      Perhaps your IP is in blocklist of mail-tester. Try sending to other ISP, like Gmail, Yahoo etc

      Reply
  4. Taher
    Taher says:
    September 2, 2022 at 7:49 am

    Wonderfull tutorial but in smtp tester i am getting error as “The SMTP server does not support authentication.” in GMASS . From SOGO i am able to send emails. Really appreciate for your help

    Reply
  5. Taher
    Taher says:
    September 2, 2022 at 7:58 am

    I successfully installed mail cow and i am able to send email from sogo to other emails but when i am trying to send SMTP request using GMASS after initial connection i am getting “The SMTP server does not support authentication.” error can you please let me know what is this problem and how to solve this

    Reply
    • Dhiraj Rahul
      Dhiraj Rahul says:
      September 9, 2022 at 2:19 am

      Perhaps port or password issue. Make sure you are using the correct password and port 465 or 587.

      Reply
  6. Andy Lim
    Andy Lim says:
    October 26, 2022 at 7:29 am

    Hi, can I use it in Oracle Cloud Ampere server with Hestia CP installed? Thks.

    Reply
    • Dhiraj Rahul
      Dhiraj Rahul says:
      November 4, 2022 at 9:10 am

      No, I don’t think Hestia Supports ARM

      Reply
  7. soroush
    soroush says:
    August 5, 2024 at 11:12 am

    hi, i have question.
    i wanna use mailcow on my local Lan for services notfcations.. and no need to publish or enything more
    in this case i have pihole dns. in pihole we can just use A and CNAME record.
    so what happened. can i use mailcow yet?
    can i use cow mail without (spf,TXT,MX record) in my local network?

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Table of Contents

Search Search

Recent Posts

  • Install Mattermost on Ubuntu/Debian
  • 17 Popular Free & Paid Mail Transfer Agents
  • Top 10 VPN Service Providers & Why!!
  • 15 Best Canva Alternatives for Graphic Design [Free & Paid]
  • 12 Best third-party SEO tools for your website
  • Best NFT Marketplace For Beginners
  • Best WordPress ad management plugin
  • What is Domain Name System blacklist (DNSBL)?
  • Introduction to the Basics of Linux
  • What is Proxy Server?

Categories

  • Chat & Collaboration
  • Domain
  • Email Marketing
  • Email Service
  • Graphic Design
  • Hosting
  • Learning Management System
  • Linux
  • Miscellaneous
  • Proxy
  • Search Engine Optimization
  • SMS
  • SMTP server
  • WooCommerce
  • Wordpress
  • WP Security
Popular
  • Postal-smtp-server
    Build Postal SMTP Server & Send Bulk Emails Step by...March 25, 2021 - 5:19 am
  • install-configure-powermta-centos-8
    Install & Configure PowerMTA on CentOS with IP rot...February 15, 2021 - 4:23 am
  • postal-create-SMTP-add-domain-SSL
    Simplest Way to Configure Postal & Create SMTP + Install...March 27, 2021 - 9:20 am
  • Install CyberPanel on Ubuntu and Create WordPress Websi...September 22, 2021 - 10:05 am
  • Create Mail Server on Windows with Open Source hMailSer...June 13, 2021 - 10:15 am
  • zimbra-free-ssl-certificate-install
    How to Install Free SSL Certificate on Zimbra Mail Serv...May 9, 2021 - 2:21 pm
  • install-zimbra-mail-server-on-centos-8
    Install Zimbra Mail Server on CentOS 7/8 Step by StepMay 9, 2021 - 6:05 am
  • Install and Configure MailCow – Best Self Hosted Mail...May 12, 2021 - 10:32 am
  • lets-encypt-certificate
    Installing Let’s Encrypt Free SSL Certificate on ...March 24, 2021 - 7:36 am
  • install-wordpress-cloud-hosting
    Super Easy Way to Install WordPress on Cloud Hosting in...March 30, 2021 - 1:35 am
Comments
  • vikasCannot "Build a new mail server" #3295 On a fresh installation...May 15, 2025 - 1:19 pm by vikas
  • SivaHow can find about aol blocking and know about email inbox...February 26, 2025 - 7:04 pm by Siva
  • RAKESH GUPTAWe want to change our default CentOS Mail Server to something...December 5, 2024 - 7:15 am by RAKESH GUPTA
  • LavisHey, Can you help me to choose good SMTP server between...November 18, 2024 - 11:12 am by Lavis
  • ApostleThis question is never answeredOctober 29, 2024 - 6:19 am by Apostle
Tags
Ahrefs Aol Canva dkim dkim generator dkim powermta dmarc generator easyengine email deliverability free Gmail install docker ubuntu install free ssl zimbra install mailcow install mailwizz install wordpress install wordpress on google install zimbra centos 8 iredmail mailcow Mailu mailu docker compose mailwizz Memberpress MTA open source chat app outlook Plugin Postal postal server postal smtp private chat server rocket.chat SEO smtp server spf generator Talos VPN WooCommerce WordPress wordpress on cloud hosting Yahoo zimbra zimbra mail server zimbra ssl

Follow us on Facebook

X Logo X Logo Followon X

Information

  • About
  • Account
  • Blog
  • Contact
  • Deals
  • List of VPS Hosting that Provides Open Port 25
  • Login
  • Newsletter
  • Privacy Policy
  • Terms of Service
  • Thank You
  • Verify Account

Resources

  • Account
  • Deals
  • Downloads
  • List of VPS Hosting that Provides Open Port 25
  • Login
  • Services
  • Thank You
  • Verify Account

Categories

  • Chat & Collaboration
  • Domain
  • Email Marketing
  • Email Service
  • Graphic Design
  • Hosting
  • Learning Management System
  • Linux
  • Miscellaneous
  • Proxy
  • Search Engine Optimization
  • SMS
  • SMTP server
  • WooCommerce
  • Wordpress
  • WP Security

Archive

  • November 2025
  • July 2023
  • June 2023
  • May 2023
  • January 2023
  • November 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • September 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
© Copyright - inGuide | Digital Marketing, Online Business & WordPress
  • Terms of Service
  • Privacy Policy
Link to: Install Docker and Docker-Compose on Ubuntu Link to: Install Docker and Docker-Compose on Ubuntu Install Docker and Docker-Compose on Ubuntu Link to: Mailu Docker Compose Setup – Build Self Hosted Mail Server Link to: Mailu Docker Compose Setup – Build Self Hosted Mail Server Mailu Docker Compose Setup – Build Self Hosted Mail Server
Scroll to top Scroll to top Scroll to top