Assuming when you say “Add Domain” we’re talking about within the mailcow’s admin UI?
If so, for this part you must only specify what’s on the right side of your intended email address. For example:
Mailcow Hostname: mail.example.com
Email Address: user@example.com
In this setup, you add “example.com” for the domain within the mailcow admin UI. You do not specify “mail.example.com” because that’s your fully-qualified hostname (FQHN.) Then you can setup mailboxes for that domain in the next tab.
The MX records are then setup as follows:
Mail Server: mail.example.com
You must also setup A (IPv4) or AAAA (IPv6) that maps “mail.example.com” to its IP address.
When all this correct, here’s what happens when another server wants to deliver an email message to your email address:
Looks up the MX record for “example.com”, gets a reply “mail.example.com”.
Looks up the A or AAAA record for “mail.example.com” to find out its IP address.
Connects on the respective port to your server to deliver the message.
–
@rcd Assuming you own “domain.com”, to have an email address of “user@mail.domain.com” means setting up a sub-domain under “domain.com” first using a CNAME record.
CNAME records are aliases, so CNAME “mail.domain.com” would be an alias to “domain.com”, then you can setup your MX and A/AAAA records for your mail server accordingly.
–
Additional notes: Make sure you setup the reverse DNS (rDNS) as well. You should be able to “name lookup” your mail.example.com hostname to get its IP and reverse lookup the IP to get the name.
Once you have all this setup and working, you’ll also need to setup 3 TXT records for your domain, otherwise your emails will quickly get marked as spam by other email systems:
SPF - https://www.cloudflare.com/learning/dns/dns-records/dns-spf-record/
DKIM - https://www.cloudflare.com/learning/dns/dns-records/dns-dkim-record/ … once you add your domain in the mailcow UI, it will generate a key for you to specify for this record
DMARC - https://www.cloudflare.com/learning/dns/dns-records/dns-dmarc-record/