Anticode Open builder

How to set up email with a custom domain without touching your website

Email and websites use different DNS records, so they can live with different companies on the same domain. Sign up with a mailbox provider, add the MX records it gives you (plus TXT records for authentication), and don't touch the A or CNAME records your website uses. Then send and receive a test before telling anyone the new address.

Updated · By the Anticode team

How email finds your domain

When someone sends mail to hello@example.com, their mail server looks up the MX records for example.com. Each MX record names a mail server and a preference number. RFC 5321, the standard for sending mail, says lower numbers are preferred, so the sender tries the lowest first and falls back to the others. Websites, by contrast, are found through A, AAAA or CNAME records on names like www. The two sets of records sit side by side in the same zone without interfering.

One catch: if a domain has no MX records at all, the standard lets senders fall back to the domain's address record. That's why setting up MX properly matters even if you don't plan to receive mail on a domain.

Choose a mailbox provider

What to compare between email providers
QuestionWhy it matters
Mailboxes or aliases?A mailbox has its own login and storage. An alias forwards to another mailbox. Many small businesses need one or two mailboxes and several aliases (hello@, bookings@).
Which apps?Webmail only, or proper support for phone and desktop mail apps and calendars.
Where is data stored?Relevant to your privacy policy and any data transfer rules.
Forwarding only?Some registrars offer free forwarding to an existing inbox. Cheap, but replies come from your old address unless you set up sending too.
Leaving laterCan you export all mail easily? Moving providers is much less painful with a clean export.

Step by step

  1. Find your DNS host. Look up the domain's nameservers; records only count where those point. If your website host manages DNS for you, you'll add mail records there.
  2. Note the existing records. Take a screenshot or export of the zone before changing anything. You'll want it if something goes wrong.
  3. Sign up with the mail provider and add your domain. It will ask you to prove control, usually with a TXT record.
  4. Add the MX records exactly as given: host @ (the bare domain), the server names and priorities the provider lists. Remove any old MX records from a previous provider, but only those.
  5. Add the SPF TXT record the provider gives you. A domain may have only one SPF record, so if one exists, merge the new provider into it rather than adding a second.
  6. Turn on DKIM in the provider's settings and add the TXT or CNAME records it shows, then add a DMARC record. The SPF, DKIM and DMARC guide explains the order.
  7. Leave website records alone. A, AAAA and CNAME records for the bare domain and www, and any verification record your site host gave you, stay exactly as they are.
  8. Create the mailboxes and aliases, and set up your phone and computer.

Test before you announce it

  • Run dig example.com MX +short (or nslookup -type=MX example.com) and confirm the new servers appear with the right priorities.
  • Send a message from an outside account, such as a personal webmail address, to the new mailbox, and reply from it.
  • Open the received reply's original headers and look for SPF and DKIM pass results.
  • Load the website again on its usual addresses, to confirm nothing changed there.

Moving from one provider to another

Lower the MX records' TTL a day before the switch, so senders pick up the change quickly. Create the mailboxes at the new provider first, switch the MX records, and keep the old mailboxes open for a week, because some mail will still arrive there while caches expire. Then copy the old mail across with the new provider's import tool, and only then close the old account.

Mistakes that break mail or the site

  • Changing nameservers to the mail provider's when it only needed MX records, which wipes the website's records unless they're recreated.
  • Two SPF records, which makes SPF fail for everything.
  • Deleting "unknown" TXT records that turn out to be a site's domain verification.
  • Mixing MX records from the old and new provider, so mail is split between them.
  • Using the new address as the login for the domain registrar itself. If mail breaks, you can't receive the reset email.

Email alongside an Anticode site

Anticode is a website host, not an email provider, so you'll need a separate mailbox provider for addresses on your domain. Connecting your domain to an Anticode site adds a CNAME for the hostname you connect and sometimes a TXT record for ownership; neither involves MX, so existing email keeps working as long as you leave its records alone. Form submissions from your site can email you at your account address and can also go to connectors such as Slack or Google Sheets, which helps when a notification email is filtered. See how DNS works for where each record lives.

Questions people ask

Will adding MX records break my website?

No. MX records only affect email. The website depends on A, AAAA or CNAME records, which you shouldn't change while setting up mail.

Can my email and website be with different companies?

Yes, and they often are. Each service gets its own records in the same DNS zone.

What does MX priority mean?

It's the order senders try your mail servers in. The lowest number is tried first; the others are backups.

Sources

  1. RFC 5321: Simple Mail Transfer Protocol, checked
  2. RFC 7208: Sender Policy Framework (SPF), checked