EN · $ USD
Business Email and Mail Servers

How to Add a Domain and Create Mailboxes in mailcow

7 min read Updated: Sunucu Atlas technical team

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
  1. Before you start
  2. 1. Add the domain
  3. 2. Create a mailbox
  4. 3. Set up aliases and a catch-all
  5. 4. Generate the DKIM key
  6. 5. Required DNS records
  7. 6. Verify the setup
  8. Common problems
  9. Next step: use mailcow preinstalled

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.com must point to your server IP. This name is the MAILCOW_HOSTNAME value in the mailcow.conf file 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 username admin and password moohoo; 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

  1. Log in as admin and go to E-Mail > Configuration.
  2. On the Domains tab, click Add domain.
  3. Enter firmaniz.com in the Domain field. Don't add www or mail in front; email addresses will end in @firmaniz.com, so enter the bare domain.
  4. 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.
  5. If present, check the DKIM selector and DKIM key length fields. We recommend leaving the selector at the default dkim and the key length at 2048 bits.
  6. 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

  1. In E-Mail > Configuration, switch to the Mailboxes tab and click Add mailbox.
  2. In the Username field, enter the part of the address before the @ sign, for example info.
  3. Select firmaniz.com from the Domain list.
  4. In the Full name field, enter the name that will appear as the sender name, for example Firma Adı Bilgi.
  5. Set the quota in MiB in the Quota field. It can't exceed the maximum you set for the domain.
  6. 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:

  1. On the Aliases tab, click Add alias.
  2. Enter satis@firmaniz.com in the Alias addresses field.
  3. Enter the destination addresses, separated by commas, in the Goto addresses field: ali@firmaniz.com, ayse@firmaniz.com
  4. 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).

  1. If the key was generated automatically when you added the domain, you'll see the firmaniz.com row and the public key in the list.
  2. If it isn't listed, enter firmaniz.com in the Domain field, leave the Selector as dkim, choose 2048 bits as the key length and click Add.
  3. 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.

TypeNameValuePurpose
Amail203.0.113.25Mail server address
MX@10 mail.firmaniz.comWhere incoming mail goes
TXT@v=spf1 mx a -allSPF: authorized senders
TXTdkim._domainkeyv=DKIM1;k=rsa;t=s;s=email;p=...DKIM public key
TXT_dmarcv=DMARC1; p=none; rua=mailto:dmarc@firmaniz.comDMARC policy
CNAMEautodiscovermail.firmaniz.comOutlook auto-configuration
CNAMEautoconfigmail.firmaniz.comThunderbird auto-configuration
SRV_autodiscover._tcp0 1 443 mail.firmaniz.comAuto-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 only dkim._domainkey.
  • Outlook can't find the server settings: The autodiscover CNAME 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.

For this guide

Recommended plans

A mail server with mailcow preinstalled, your own IP address and support for unlimited domains and mailboxes lets you jump straight into the steps in this guide without dealing with installation.

SA-MAILSERVER-1

mailcow
Recommended

6 GB RAM

$50.12/yr

+VAT

  • Processor2 CPU
  • Disk250 GB NVMe
  • LocationIstanbul
  • 1G Port
  • mailcow Pre-installed
  • No Account or Domain Limits
  • Your Own IP Address

SA-MAILSERVER-2

mailcow

8 GB RAM

$70.17/yr

+VAT

  • Processor4 CPU
  • Disk500 GB NVMe
  • LocationIstanbul
  • 1G Port
  • mailcow Pre-installed
  • No Account or Domain Limits
  • Your Own IP Address

SA-MAILSERVER-3

mailcow

12 GB RAM

$100.26/yr

+VAT

  • Processor6 CPU
  • Disk750 GB NVMe
  • LocationIstanbul
  • 1G Port
  • mailcow Pre-installed
  • No Account or Domain Limits
  • Your Own IP Address

Mail Server — tüm paketler

Need help with setup?

Send questions about your service in a support ticket, and our technical team will walk you through it step by step.