Open Source

Business email on your own domain: your own server or a cloud service

I compare running your own mail server with cloud email for a company: who each option suits, which DNS settings keep your mail out of spam, and how to move mailboxes without losing messages.

Alexei Sergeev 3 min read

Email on your own domain is a basic thing for a company: an address like info@company.com looks more serious than a free mailbox and stays with the company when an employee leaves. The question is where to host it: on your own server or with a cloud service. I set up both and do not think one is always better than the other.

Cloud email: when it is enough

For most small companies a cloud service is a sensible choice. You do not need to maintain a server or keep track of updates, IP reputation and spam filtering. You pay per mailbox and get a web interface, mobile apps and calendars. The downsides are dependence on the provider, its limits and pricing, and your data is stored wherever the provider decides.

Your own server: when it is justified

Your own server makes sense if it matters where your correspondence is physically stored, if you need custom mail processing rules, integrations with internal systems, many mailboxes or large volumes. The price is ongoing maintenance: updates, monitoring, backups and making sure mail gets delivered. I usually build self-hosted mail on Postfix and Dovecot, or on a ready-made bundle such as Mailcow, in Docker.

Criterion Cloud service Own server
Getting started Quick, no hardware of your own Requires a server and setup
Maintenance Done by the provider Ongoing, by you or a contractor
Control over data Limited by the provider's terms Full
Deliverability Usually good out of the box Depends on setup and address reputation
Integrations and custom rules Within the service's capabilities Anything

DNS records that keep your mail out of spam

Whichever option you choose, the domain must be configured correctly. Recipients' mail systems check whether a server is allowed to send mail on behalf of the domain. Without these records, even ordinary emails to clients will end up in spam or not arrive at all.

Domain DNS records
; MX: where to deliver mail for the domain
company.com.                 MX   10 mail.company.com.

; SPF: which servers may send mail on behalf of the domain
company.com.                 TXT  "v=spf1 mx -all"

; DKIM: public key for verifying message signatures (issued by the mail server or service)
mail._domainkey.company.com. TXT  "v=DKIM1; k=rsa; p=MIIBIjANBgkqh..."

; DMARC: what to do with messages that fail the checks, and where to send reports
_dmarc.company.com.          TXT  "v=DMARC1; p=quarantine; rua=mailto:dmarc@company.com"

I usually start DMARC in p=none mode for a couple of weeks so that the reports show which other systems send mail on behalf of the domain: the website, the CRM, a newsletter service. They are added to SPF, and only then is the policy tightened.

Moving mail without losing messages

Mailboxes are easy to move with imapsync: it copies messages and folders from one IMAP server to another and, when run again, copies only what is new. The order is: create the mailboxes on the new server in advance and copy the archive, then switch the MX record, and after that run the sync once more to pick up messages that arrived on the old server during the transition. Employees need to be told in advance how to connect their mailbox in its new home.

A mail server is one of the tasks in open-source deployments. If you need both mail and shared files, it makes sense to look at combining them with a corporate cloud and single sign-on from the start.

Need to set up or move your company email?

Tell me how many mailboxes you have and where your mail is now. I will propose an option, configure DNS and move the messages.

Discuss your task

Alexei SergeevEngineer, IT infrastructure and DevOps

Read next

Office network segmentation on MikroTik: VLANs for staff, guests and servers

Why a flat network where every device sees every other one is the main source of trouble in a small office, and how to split it into VLANs on MikroTik with RouterOS 7: the layout, bridge configuration, firewall rules an…

Backup internet for the office: two ISPs and automatic failover on MikroTik

How to set up a second internet connection so the office switches to it automatically and back again when the main provider recovers. Recursive routing on MikroTik, reachability checks and the pitfalls.