In short
To add a domain to mailcow, go to E-Mail > Configuration > Domains in the admin panel and use Add domain to set the domain and its quotas. Then create mailboxes in the Mailboxes tab, aliases in the Aliases tab, and generate a DKIM key. Finally, add the MX, SPF, DKIM, DMARC and autodiscover records to your domain's DNS and confirm they all show green in the panel's DNS check.
In this guide
mailcow is an open-source mail server suite that runs components such as Postfix, Dovecot, Rspamd, SOGo and ClamAV together as Docker containers. Adding a new domain to mailcow takes four steps: define the domain in the panel, create mailboxes and aliases, generate the DKIM key, and add the required DNS records to your domain. This guide walks through each step, along with the most common mistakes.
In the examples, the mail server hostname is mail.firmaniz.com, its IP address is 203.0.113.25, and the domain being added is firmaniz.com. Replace them with your own values.
Before you start
- The server hostname must be ready: The A record for
mail.firmaniz.commust point to your server IP. This name is theMAILCOW_HOSTNAMEvalue in themailcow.conffile at install time. - A PTR record must be set: The reverse DNS record of your server IP must point to the same name. For details, see the PTR (reverse DNS) record guide.
- Admin login: The panel opens at
https://mail.firmaniz.com. A default mailcow install ships with the admin usernameadminand passwordmoohoo; change the password on first login and turn on two-factor authentication.
Menu names may differ slightly depending on the version and interface language. This guide uses the names from the English interface.
1. Add the domain
- Log in as admin and go to E-Mail > Configuration.
- On the Domains tab, click Add domain.
- Enter
firmaniz.comin the Domain field. Don't addwwwormailin front; email addresses will end in@firmaniz.com, so enter the bare domain. - Set the quotas:
- Max. possible aliases: The maximum number of aliases that can be created on this domain.
- Max. possible mailboxes: The maximum number of mailboxes.
- Default mailbox quota: The storage given to a new mailbox by default (MiB).
- Max. quota per mailbox: The highest quota a single mailbox can have.
- Total domain quota: The combined quota of all mailboxes on the domain.
- If present, check the DKIM selector and DKIM key length fields. We recommend leaving the selector at the default
dkimand the key length at 2048 bits. - Save using the Add domain and restart SOGo option. If SOGo webmail is not restarted, users on the new domain may not be able to log in to webmail right away.
You can change quota settings later from the domain's edit screen. If you serve multiple clients or departments, plan the total quota so it doesn't exceed your disk.
2. Create a mailbox
- In E-Mail > Configuration, switch to the Mailboxes tab and click Add mailbox.
- In the Username field, enter the part of the address before the
@sign, for exampleinfo. - Select
firmaniz.comfrom the Domain list. - In the Full name field, enter the name that will appear as the sender name, for example
Firma Adı Bilgi. - Set the quota in MiB in the Quota field. It can't exceed the maximum you set for the domain.
- Set a strong password, enter it again and save.
Once the mailbox is created, the user can log in to SOGo webmail at https://mail.firmaniz.com/SOGo with their full email address and password. For desktop and mobile clients, the server name is mail.firmaniz.com for every protocol; the standard ports are 993 for IMAP (SSL/TLS), 465 (SSL/TLS) or 587 (STARTTLS) for SMTP submission, and 995 for POP3.
To set a sending limit, use the rate limit setting on the mailbox's edit screen. It is the simplest way to stop a compromised account from sending thousands of spam messages in a short time.
3. Set up aliases and a catch-all
An alias is an address with no mailbox of its own that forwards incoming mail to one or more real mailboxes. For example, if you want mail sent to satis@firmaniz.com to reach two sales reps:
- On the Aliases tab, click Add alias.
- Enter
satis@firmaniz.comin the Alias addresses field. - Enter the destination addresses, separated by commas, in the Goto addresses field:
ali@firmaniz.com, ayse@firmaniz.com - Save.
If you enter only the domain as the alias address, such as @firmaniz.com, you create a catch-all: all mail sent to nonexistent addresses goes to the destination. A catch-all also collects spam from dictionary attacks, so use it only if you really need it.
If you want to use the same mailboxes with a second domain (for example firmaniz.com.tr), define an alias domain on the Alias domains tab instead of creating a separate alias for each address. Mail sent to info@firmaniz.com.tr then lands in the info@firmaniz.com mailbox automatically.
4. Generate the DKIM key
DKIM (DomainKeys Identified Mail) signs your outgoing mail with a private key and lets the recipient verify that signature against the public key in DNS. In mailcow, DKIM keys are managed under System > Configuration > Options > ARC/DKIM keys (in older versions this section is under Configuration & Details).
- If the key was generated automatically when you added the domain, you'll see the
firmaniz.comrow and the public key in the list. - If it isn't listed, enter
firmaniz.comin the Domain field, leave the Selector asdkim, choose 2048 bits as the key length and click Add. - Copy the value that starts with
v=DKIM1;k=rsa;t=s;s=email;p=.... You will add it as a TXT record in the next step.
Some DNS panels don't accept TXT values longer than 255 characters as a single string. In that case, split the value into multiple quoted strings; DNS resolvers join the parts back together when reading it.
5. Required DNS records
Create the following records in your domain's DNS panel. The DNS button in mailcow's domain list shows exactly which records are expected and which are set correctly; compare the table below against the values shown there.
| Type | Name | Value | Purpose |
|---|---|---|---|
| A | 203.0.113.25 | Mail server address | |
| MX | @ | 10 mail.firmaniz.com | Where incoming mail goes |
| TXT | @ | v=spf1 mx a -all | SPF: authorized senders |
| TXT | dkim._domainkey | v=DKIM1;k=rsa;t=s;s=email;p=... | DKIM public key |
| TXT | _dmarc | v=DMARC1; p=none; rua=mailto:dmarc@firmaniz.com | DMARC policy |
| CNAME | autodiscover | mail.firmaniz.com | Outlook auto-configuration |
| CNAME | autoconfig | mail.firmaniz.com | Thunderbird auto-configuration |
| SRV | _autodiscover._tcp | 0 1 443 mail.firmaniz.com | Auto-configuration fallback |
You can also add optional SRV records so that some clients can discover the server settings on their own:
_imaps._tcp.firmaniz.com. 3600 IN SRV 0 1 993 mail.firmaniz.com.
_submissions._tcp.firmaniz.com. 3600 IN SRV 0 1 465 mail.firmaniz.com.
_submission._tcp.firmaniz.com. 3600 IN SRV 0 1 587 mail.firmaniz.com.
_pop3s._tcp.firmaniz.com. 3600 IN SRV 0 1 995 mail.firmaniz.com.
If you are adding a second domain (for example, adding ikincifirma.com while the mail server is mail.firmaniz.com), you don't need an A record for the new domain. Point its MX record and autodiscover CNAME records directly to mail.firmaniz.com, and add the SPF, DKIM and DMARC records to the new domain's own DNS. Each domain has its own DKIM key.
Start DMARC with p=none, and once the reports show that all legitimate mail passes SPF and DKIM, raise it to p=quarantine and then p=reject. To learn how these records work in depth, see our article on how to create SPF, DKIM and DMARC records.
6. Verify the setup
After the DNS records propagate, make sure every row on the DNS screen in the mailcow panel is green. You can also check from the command line:
dig MX firmaniz.com +short
dig TXT firmaniz.com +short
dig TXT dkim._domainkey.firmaniz.com +short
dig TXT _dmarc.firmaniz.com +short
Finally, send a test message from the new mailbox to a Gmail address and check on the Show original screen that SPF, DKIM and DMARC all show PASS. If any of them fails, recheck the related DNS record and whether it has propagated. For detailed settings, see the official mailcow documentation.
Common problems
- Users can't log in to webmail with the new domain: SOGo may not have been restarted when the domain was added. Edit the domain and save it using the restart option.
- The DKIM check is red: Characters were lost when the TXT value was split, or the domain was appended twice to the record name (
dkim._domainkey.firmaniz.com.firmaniz.com). If your panel appends the domain automatically, enter onlydkim._domainkey. - Outlook can't find the server settings: The
autodiscoverCNAME record is missing, or it is served behind a proxy with the wrong certificate. - Mail arrives but can't be sent: Authentication for the outgoing server is turned off in the client, or port 465/587 is blocked on the local network.
Next step: use mailcow preinstalled
The steps above assume mailcow is correctly installed on a healthy server. If you want to skip installation, certificates and updates and go straight to adding domains, Sunucu Atlas mail server plans are delivered in Istanbul with mailcow preinstalled, your own IP address, SOGo webmail, the Rspamd spam filter, ClamAV virus scanning and automatic SSL certificates, with no limit on accounts or domains. If you will host multiple domains and dozens of mailboxes along with their archives, SA-MAILSERVER-2 with 4 CPUs, 8 GB RAM and a 500 GB NVMe disk is a balanced choice. Smaller teams can start with SA-MAILSERVER-1; with root access, you can change any setting directly later on.
Frequently asked questions
How many domains can I add to mailcow?
mailcow itself has no limit on the number of domains; the practical limit is your server's disk, RAM and CPU capacity. Sunucu Atlas mail server plans also have no limit on accounts or domains.
Where do I create a DKIM key in mailcow?
In current versions, under System > Configuration > Options > ARC/DKIM keys. If the key was generated automatically when you added the domain, it already appears in that list.
Why can't users on a newly added domain log in to SOGo?
SOGo may not have been restarted after the domain was added. Use the Add domain and restart SOGo option when saving, or edit the domain and save it with the restart option.
Does a second domain need its own mail server hostname?
No. You can point the second domain's MX and autodiscover records to the existing mail.firmaniz.com name; SPF, DKIM and DMARC records are set separately on each domain.
What is the difference between an alias and a mailbox?
A mailbox is a real account that stores mail and that you log in to with a password. An alias is an address with no storage of its own that forwards incoming mail to one or more mailboxes.