Email

Setting Up Email on Your Own Domain

Go from a bare domain to working you@yourdomain mail, with MX, SPF, DKIM and DMARC records explained step by step.

Key takeaways

  • MX records direct incoming mail, while SPF, DKIM and DMARC help receivers trust the mail you send.
  • Use the exact record values from your mail provider, and publish only one SPF record per domain name.
  • Start DMARC in monitoring mode and tighten it after you know every system that sends as you.
  • Secure the domain registrar account, because whoever controls DNS controls your mail.

To get mail at your own domain, you need three things: the domain itself, a service that stores and sends the mail, and a set of DNS records that connect the two. The records tell the world where to deliver your mail and which servers are allowed to send it.

Most of the work takes an afternoon. You'll choose a mail service, add the domain to it, publish the records it gives you, create addresses and test. This guide walks through each step and the mistakes that most often break delivery.

What you need before you start

A domain. If you don't have one, pick a name that is easy to say and spell, and register it in your own name or your company's, with an email contact that doesn't depend on that same domain. How to choose a domain name covers the choice.

Access to DNS. DNS (the Domain Name System) is the directory that maps your domain to services. You edit it at whichever company hosts your zone, often the registrar, sometimes a web host or a separate DNS service.

A mail service. You can use a hosted business mail suite, a mail-only provider, a forwarding service that relays to an existing inbox, or your own server.

Option Good for Watch out for
Business mail suite Teams that want calendar and files Per-user cost
Mail-only host Simple mailboxes Fewer collaboration tools
Forwarding service One person, receive-mostly Sending as your domain may be limited
Own server Learning and special needs Maintenance and deliverability work

Choosing a business email provider compares what to look for, and running your own mail server is honest about the last row.

The records and what they do

Four DNS records behind domain email
MX 10 mail.example.net 1 v=spf1 include:... -all 2 selector._domainkey 3 _dmarc v=DMARC1; p=none 4 MX Names the server that receives mail for the domain. 1 SPF (TXT) Lists which servers may send using the domain. 2 DKIM Publishes the public key that verifies message signatures. 3 DMARC (TXT) Says what receivers should do when checks fail, and where to report. 4 MX 10 mail.example.net 1 v=spf1 include:... -all 2 selector._domainkey 3 _dmarc v=DMARC1; p=none 4 MX Names the server that receives mail for the domain. 1 SPF (TXT) Lists which servers may send using the domain. 2 DKIM Publishes the public key that verifies message signatures. 3 DMARC (TXT) Says what receivers should do when checks fail, and where to report. 4

A complete set for a fictional provider might look like this.

example.com.                       MX     10 mx1.mailhost.example.net.
example.com.                       MX     20 mx2.mailhost.example.net.
example.com.                       TXT    "v=spf1 include:_spf.mailhost.example.net -all"
s1._domainkey.example.com.         CNAME  s1.example-com.dkim.mailhost.example.net.
_dmarc.example.com.                TXT    "v=DMARC1; p=none; rua=mailto:[email protected]"

Your provider's values will differ. Some give DKIM as a TXT record containing the key, others as a CNAME pointing at a record they manage. Copy them exactly.

Step by step

From domain to working mailbox
1 Add the domain Tell the mail service which domain you want to use. 2 Prove ownership Publish the verification record it gives you. 3 Create mailboxes Make users and aliases before mail starts flowing. 4 Point MX Replace old MX records with the new ones. 5 Authenticate Add SPF, DKIM and DMARC and turn on signing. 6 Test Send both ways with an outside account. Add the domain Tell the mail service which domain you want to use. 1 Prove ownership Publish the verification record it gives you. 2 Create mailboxes Make users and aliases before mail starts flowing. 3 Point MX Replace old MX records with the new ones. 4 Authenticate Add SPF, DKIM and DMARC and turn on signing. 5 Test Send both ways with an outside account. 6

1. Verify the domain

The service typically asks you to add a TXT record with a random token. This proves you control the domain. Leave it in place unless the provider says otherwise.

2. Create addresses first

Add the real mailboxes before you switch MX records, so early messages aren't rejected. Create postmaster@, which mail standards expect to exist, and abuse@ if you can. Use aliases for roles such as hello@ or billing@, or a shared mailbox if several people will answer.

3. Publish the MX records

Add the new MX records and remove old ones, including any default records your registrar or web host created. A leftover entry can swallow part of your mail. The target of an MX record must be a hostname, never an IP address. MX records explains preference numbers.

In many DNS editors, @ means the domain itself. Some editors append your domain to whatever you type, so entering a full name can produce example.com.example.com. Check the saved result.

4. Set up SPF

SPF is a TXT record starting with v=spf1. It lists permitted senders and ends with a rule for everyone else: ~all (soft fail) or -all (fail). Have only one SPF record per name. If a newsletter tool or web app also sends for you, merge its include: into the same record. SPF evaluation is limited to 10 DNS lookups, so don't pile up includes. SPF explained goes through the syntax.

5. Turn on DKIM

DKIM adds a cryptographic signature to each outgoing message. Publish the record from your provider, then enable signing in its admin panel; publishing the record alone may not start it. See DKIM explained.

6. Add DMARC

DMARC ties SPF and DKIM to the address people see in the From line. Start with p=none, which asks receivers to take no action but lets you collect reports. Once your legitimate mail passes, move to p=quarantine and then p=reject. DMARC explained describes alignment, the part that trips people up.

Test it

Wait for DNS changes to reach resolvers, then check from a computer.

dig MX example.com +short
dig TXT example.com +short
dig TXT _dmarc.example.com +short

On Windows, you can use:

Resolve-DnsName example.com -Type MX
Resolve-DnsName example.com -Type TXT
Resolve-DnsName _dmarc.example.com -Type TXT

Then send a message from your new address to an account at a different provider, and reply to it. In the received copy, view the original message and look at the authentication results. You want SPF, DKIM and DMARC to show as passing. Reading email headers shows where to look.

Plan your addresses

A little planning avoids awkward renames. Pick one pattern for people, such as first name or first.last, and apply it consistently. First names are friendly in a tiny team and collide as soon as a second Alex joins.

Use role addresses for functions that outlast any one person. Customers should write to support@ or accounts@, so that holidays and departures don't strand their mail. Decide who receives each before you publish it.

Think twice about a catch-all, which accepts mail for any name at your domain. It rescues typos, but it also collects large volumes of spam aimed at guessed addresses and can hide the fact that a sender has the wrong address. If you enable one, route it to a separate folder.

If the domain doesn't send mail

Perhaps you own extra domains for brand protection or redirects. Forgers can still try to use them. You can say plainly that they send nothing.

example.net.          TXT   "v=spf1 -all"
_dmarc.example.net.   TXT   "v=DMARC1; p=reject"
example.net.          MX    0 .

The last line is the "null MX" record defined in RFC 7505, which states that the domain accepts no mail. Use it only on a domain that truly receives none, including account notices.

The first two weeks

Delivery problems tend to appear soon after setup, so keep an eye out.

  1. Read incoming DMARC aggregate reports, or feed them to a tool that summarizes them. Reading DMARC reports shows what the fields mean.
  2. Look for legitimate sources that fail, such as a forgotten invoicing service, and fix them before tightening policy.
  3. Send test mail to a few different providers and check the spam folders.
  4. Ask colleagues to report bounce messages and keep the full text, which usually names the reason.
  5. Avoid sending large batches from a brand-new domain; let normal correspondence establish it.

If mail to you fails, check the MX records first and the existence of the mailbox second. If mail from you lands in spam, check authentication results in a received copy before changing anything else. Common DNS mistakes is a useful second list.

Connect your apps

Phones and desktop clients need to know the incoming server (IMAP is the usual choice), the outgoing server for submission, and your full address as the username. Use encrypted ports as your provider specifies, commonly 993 for IMAP and 465 or 587 for submission. Many services require modern sign-in or app-specific passwords. How to set up email on a new device has the walkthrough.

Don't forget your other senders

Websites, invoicing tools, calendars and newsletter platforms may all send as your domain. List them. Each should either send through your mail provider or be authorized in SPF and sign with DKIM for your domain. A website contact form that sends directly from a web server, pretending to be the visitor's address, will often be rejected. Send from your own address and put the visitor's address in Reply-To.

Bulk mail deserves its own subdomain, such as news.example.com, so its reputation stays somewhat separate from everyday correspondence.

What goes wrong most often

  • Two SPF records. Receivers treat this as an error.
  • Old MX records left behind. Some mail goes to the old host.
  • DKIM published but not enabled. Signatures never appear.
  • DNS edited in the wrong place. If your name servers point elsewhere, changes at the registrar do nothing.
  • Cached answers. Records with long TTLs linger. The DNS TTL change planner helps you time a switch.

Protect the foundation

Anyone who can change your DNS can redirect your mail and receive password resets for your accounts. Use a strong unique password and two-factor authentication on the registrar, DNS host and mail admin accounts. Keep auto-renew on and the payment method current. Keep a recovery address outside your own domain for those accounts. If the domain lapses, someone else may register it and receive your mail.

If you're moving from an existing address

Keep the old address working and forwarding for a long transition, tell your contacts, and update the logins of important services one at a time. Start with banking and anything used for account recovery.

Written for 4Internet with AI writing tools and not reviewed line by line by a person. Check anything you rely on with the maker, provider or standard concerned. Report an error.

Keep reading

All 45 articles in Email →

Latest news on this topic