INITWIN · Editorial
Software & digital strategy
How to build your own company email server with Mailcow, without monthly per-user subscriptions
Mailcow on Docker: costs, DNS (SPF, DKIM, DMARC), mailboxes, deliverability, backup and an alternative to Google Workspace
How to build your own company email server with Mailcow: costs, Docker, DNS (SPF, DKIM, DMARC), mailboxes for staff, deliverability, backup and a comparison with Google Workspace.
Do you want professional email addresses for your company, such as contact@company.com or office@company.com, without paying monthly per employee? There is an open-source alternative to Google Workspace and Microsoft 365: your own email server, built with Mailcow.
Most companies use email services hosted by external providers. They are convenient, but costs grow with the number of users. For a company with 20 or 30 employees, subscriptions can become a significant annual expense.
With Mailcow you can manage your own mailboxes, domains, passwords, antispam filters and calendars, without buying a licence for each account.
There is an important difference, though: the software is free, but the infrastructure and server administration are not necessarily free.
In this guide we explain what Mailcow is, how much a self-hosted email server costs, and how you can install and configure it for your company.
1. Why run your own email server?
Email is one of the most important communication tools in a company. Through it you send offers, contracts, invoices, documents and confidential information.
A solution such as Google Workspace or Microsoft 365 gives you already-managed infrastructure, but usually requires a per-user subscription.
Take a hypothetical example. A company has 20 employees and pays the equivalent of €6 per month for each mailbox.
- 20 users × €6 = €120 per month
- €120 × 12 months = €1,440 per year
- Over three years, the cost reaches €4,320
This is an illustrative example, not a current commercial offer.
By contrast, a self-hosted email server can host many accounts without a per-user licensing fee.
The main advantages of your own server are:
- Control over email infrastructure and configuration.
- Creating many mailboxes and aliases without extra licences.
- The ability to host multiple domains.
- Managing security and retention policies.
- Independence from commercial subscription changes.
You must still account for administrative responsibility. If the server has problems, messages may be delayed or temporarily inaccessible.
For that reason, Mailcow is a good choice for companies that have internal technical skills or work with an IT administrator.
2. What is Mailcow and how does it work?
Mailcow is an open-source, Docker-based email platform that integrates the main components needed to run a mail server.
Instead of installing and configuring each application individually, Mailcow gives you an integrated system with a web interface for administration.
Its components include:
- Postfix — handles sending and routing messages via SMTP.
- Dovecot — provides IMAP access to mailboxes and manages storage.
- Rspamd — analyses messages to identify spam.
- ClamAV — provides antivirus checking, if enabled.
- SOGo — provides webmail, calendars and contacts.
- MariaDB and Redis — manage data and some internal platform functions.
Mailcow also includes two-factor authentication support for certain functions, domain administration, aliases and access policies.
Users can access email from the browser or through apps such as Outlook, Thunderbird and mobile email clients.
An important advantage is that you do not need to build this infrastructure from scratch. Most services are already integrated, and configuration is done centrally.
The project and official documentation are available at mailcow.email and docs.mailcow.email.
3. How much does a Mailcow email server cost?
Even though Mailcow does not charge per-user subscriptions, you need a server permanently connected to the internet.
For a small company, a common option is a VPS — a virtual private server. Cost depends on the provider, allocated resources, storage, backup and the level of administration.
| Component | Indicative cost |
|---|---|
| Mailcow software | €0 |
| VPS with 8 GB RAM | €12–30/month |
| Domain | Depends on registrar |
| External backup | €3–10/month |
| Administration and monitoring | Variable |
Figures are indicative estimates, not guaranteed prices.
For example, a €20/month VPS and a €5/month backup service would mean roughly €300 per year in infrastructure cost, excluding domain, administration and other services.
For a company with 20 mailboxes, the difference versus individual subscriptions can be significant.
Still, you must calculate total cost of ownership, including technical interventions, monitoring, data restoration and the time required for maintenance.
Mailcow is financially advantageous especially when many users share the same infrastructure and it is administered efficiently.
4. What do you need before installation?
For this tutorial we use an Ubuntu 24.04 LTS server, your own domain and Docker.
Before you start, you need:
- A VPS with a static public IP address.
- At least 6 GiB RAM and 1 GiB swap for the default Mailcow configuration.
- At least 20 GiB for the system, plus space for email storage.
- A domain, for example
company.com. - SSH access with administrative privileges.
- The ability to modify DNS records.
For about 5–10 users, Mailcow documentation recommends 8 GiB RAM. For larger teams or heavy use, resources must be sized accordingly.
Before purchase, check whether the VPS provider allows SMTP traffic on port 25 and reverse DNS (PTR) configuration. Many providers restrict this port to reduce spam.
Without proper SMTP connectivity, the server may work locally but will not communicate correctly with all other mail servers.
It is recommended to use a VPS dedicated to email, not one that already hosts many web applications.
5. Installing Docker and Mailcow on Ubuntu
After you create the server and connect via SSH, the first step is updating the system.
sudo apt update
sudo apt upgrade -y
Install the required tools:
sudo apt install -y \
git openssl curl gawk \
coreutils grep jq ca-certificates
Mailcow requires Docker Engine version 24 or newer and Docker Compose version 2 or newer.
For Docker installation, follow the official Ubuntu instructions at docs.docker.com.
After installation, check the versions:
docker --version
docker compose version
Now we can install Mailcow. Go to /opt and clone the official project:
cd /opt
sudo git clone \
https://github.com/mailcow/mailcow-dockerized
cd mailcow-dockerized
Generate the configuration file:
sudo ./generate_config.sh
The script will ask for the mail server hostname. For our example, we use:
mail.company.com
This must be a fully qualified DNS name, not just company.com.
After generation, you can edit the configuration:
sudo nano mailcow.conf
Especially check:
MAILCOW_HOSTNAME=mail.company.com
For a start, keep the default configuration unless you have special requirements.
Before starting the containers, make sure the required ports are available and that no other SMTP or web server is using them.
Pull the Docker images and start the application:
sudo docker compose pull
sudo docker compose up -d
Check container status:
sudo docker compose ps
If services start correctly, the admin interface should be available at:
https://mail.company.com/admin
The domain must already be configured in DNS for this to work.
Official documentation indicates for a new install the user admin and the initial password moohoo. Change the password immediately after the first login, before production use.
Also enable multifactor authentication for administrative accounts.
6. DNS configuration: the most important step
Installing the application is only part of the process. For messages to reach recipients correctly, you must configure the domain.
Assume the company domain is company.com and the server has the fictional IP 203.0.113.10.
In the domain DNS panel configure these records:
| Type | Name | Value |
|---|---|---|
| A | 203.0.113.10 | |
| MX | @ | 10 mail.company.com |
| TXT | @ | v=spf1 mx -all |
| CNAME | autoconfig | mail.company.com |
| CNAME | autodiscover | mail.company.com |
The IP address is only an example. Replace it with the real server IP.
- The A record associates the server name with its IP address.
- The MX record indicates where messages for the domain must be delivered.
- The SPF record specifies which servers are authorised to send email for the domain. The example above assumes only servers indicated by MX may send.
If you also use external platforms for newsletters, invoicing or notifications, the SPF configuration must be adapted.
Enabling DKIM
DKIM adds a cryptographic signature to outgoing messages.
From the Mailcow interface you can generate the DKIM key for your domain. The platform will provide a TXT record to enter in DNS. The selector name and public key must be copied exactly from Mailcow.
Do not use a DKIM key taken from a tutorial — each domain must use its own key.
Enabling DMARC
DMARC helps recipients decide what to do when a message fails authentication and alignment checks.
To start, you can use a monitoring policy:
Name: _dmarc
Type: TXT
Value: v=DMARC1; p=none
Later, after you verify all legitimate sending sources, you can move to more restrictive policies such as quarantine or reject.
Configuring PTR
PTR, also known as reverse DNS, makes the reverse association between the IP address and the server name.
For our example:
203.0.113.10 → mail.company.com
This record is usually configured in the VPS provider panel, not in the ordinary domain DNS zone.
It is important that the server name, DNS resolution and SMTP configuration are consistent.
If you use IPv6, configure IPv6 records correctly as well. Otherwise, it is better to avoid publishing an incomplete IPv6 setup.
7. Creating mailboxes for employees
After domain configuration, you can start creating accounts.
Sign in to the Mailcow admin panel and add the domain company.com in the email domains section.
Then create the mailboxes you need:
contact@company.com— general requests.office@company.com— administrative communication.billing@company.com— financial documents.sales@company.com— offers and commercial requests.firstname.lastname@company.com— individual addresses for employees.
For each user you can set a password and a storage quota.
You can also create aliases — additional addresses that forward messages to an existing mailbox. For example, support@company.com can be an alias to contact@company.com, without a separate account.
This flexibility is useful for companies that want to organise communication by department.
8. How do you configure email in Outlook or on a phone?
Users are not required to use the Mailcow web interface. They can keep working with the apps they already know.
For a classic IMAP client, the configuration may look like this:
| Setting | Value |
|---|---|
| IMAP server | mail.company.com |
| IMAP port | 993 |
| IMAP security | SSL/TLS |
| SMTP server | mail.company.com |
| SMTP port | 587 |
| SMTP security | STARTTLS |
| Username | contact@company.com |
| Password | Account password |
These settings assume a standard Mailcow install, with the respective services enabled and a valid TLS certificate. SMTP authentication must be enabled for sending.
In parallel, employees can use the SOGo interface for reading email and managing calendars and contacts.
Depending on the app, automatic setup via Autoconfig or Autodiscover can simplify adding accounts.
9. How do you keep your messages out of spam?
One of the most important challenges of running your own email server is deliverability.
The fact that Mailcow works correctly does not guarantee that every message will reach the recipient’s inbox. Gmail, Outlook and other providers use many mechanisms to identify suspicious messages.
Besides SPF, DKIM and DMARC, IP reputation also matters. If the VPS IP was previously used for spam, some messages may be rejected.
Before migrating all company mailboxes, check IP reputation and test sending to several providers.
Useful tools include:
- mail-tester.com — analyses configuration and sent messages.
- mxtoolbox.com — checks DNS, SMTP and blocklists.
- Google Postmaster Tools — can provide reputation and deliverability information for eligible traffic.
Avoid suddenly sending large volumes of marketing email from a new server. For newsletters and mass campaigns, a specialised service separate from operational company email is often more suitable.
10. Backup, security and maintenance
If you choose to host company email, you also become responsible for protecting the data.
An email server often contains contracts, invoices, client conversations and other important documents. For that reason, backup is not optional.
Mailcow includes a script for saving system components. From the installation directory you can run:
sudo ./helper-scripts/backup_and_restore.sh \
backup all
The script will ask where to store the copy.
We recommend keeping backups in an external location as well, separate from the main VPS. A copy stored only on the same server does not protect you against losing the entire virtual machine.
Equally important is periodically verifying the restore procedure.
To update Mailcow, the project provides:
cd /opt/mailcow-dockerized
sudo ./update.sh
Before major updates, create a backup and check the release notes.
On security, also implement basic rules: SSH access via keys, a correctly configured firewall, strong passwords, multifactor authentication for administrators and resource monitoring.
Do not close SMTP, IMAP or HTTPS ports required by the services you use. Monitor disk space, mail queues, TLS certificates and server availability.
Finally, define who is responsible for administration and how incidents are handled.
11. Mailcow or Google Workspace: which should you choose?
There is no perfect solution for every company.
Google Workspace and Microsoft 365 offer professionally managed email and integration with collaboration, storage and productivity tools.
Mailcow focuses on hosting and administering email and groupware services, offering more control over infrastructure.
| Criterion | Mailcow | Commercially hosted email |
|---|---|---|
| Licence per user | No | Usually yes |
| Server administration | Your responsibility | Provider |
| Infrastructure control | High | Limited |
| Backup and monitoring | Must be organised | Depends on service and plan |
| Office integration | Limited | Often extensive |
| Initial setup | Technical | Simpler |
For a company without IT staff, managed services may be more convenient.
By contrast, a company that already has infrastructure, Linux experience and a need for many addresses can gain important advantages with Mailcow.
Real savings must be calculated long term, including all operational costs.
12. Conclusion: is self-hosting email worth it?
Mailcow shows that a company is not obliged to pay individual licences to have professional email addresses on its own domain.
With a VPS, Docker and correct DNS configuration, you can build a modern email infrastructure for your company. You can manage users, domains, aliases, antispam filters and calendars from a central interface.
At the same time, you must treat the email server as a critical IT infrastructure component. Security, deliverability, backup and maintenance are just as important as the initial installation.
For companies that want to reduce subscription dependency and keep more control over IT services, Mailcow can be a very interesting alternative.
At INITWIN we believe IT infrastructure must match each company’s real needs. If you are considering a move to a self-hosted email server, start by evaluating the number of users, message volume, security requirements and administration costs.
Contact the INITWIN team to discuss which infrastructure option fits your company. For storage and collaboration on controlled infrastructure, see also INITWIN Cloud.
Frequently asked questions about Mailcow
Is Mailcow completely free? The Mailcow software is open-source and can be used without per-account licensing fees. However, the server, domain, backup and administration can generate costs.
Can I create 50 email addresses? Yes. Mailcow does not impose a subscription per address. The practical number of users depends on server resources, available space and configuration.
Can I use Mailcow with Outlook? Yes. Mailcow provides access through standard protocols such as IMAP and SMTP, compatible with many email clients.
Is Mailcow suitable for a small company? Yes, if the company has access to the technical skills needed for installation, monitoring and maintenance.
Can I migrate existing emails? Yes. Message migration can be done with IMAP-compatible tools. For a full migration you must separately plan accounts, passwords, contacts, calendars and changing MX records.
Is Mailcow more secure than Gmail? Not automatically. Security depends on configuration, updates, access control and monitoring. A professionally managed service can be safer than a poorly maintained self-hosted server.
Keep reading
- Why do my emails go to spam? Complete guide to SPF, DKIM, DMARC and server reputation
- How to prepare your team for new software: training, adoption and resistance to change
- The 8-week MVP: how to launch a product idea without burning the budget
- Sovereign software: developed in Europe, for Europeans
Need guidance on a similar project or a technical audit?