How to set up SPF, DKIM and DMARC for Mailtrap

The DNS records Mailtrap needs, why SPF needs no changes, and how to get your domain verified.

Some links on this page are affiliate links. If you sign up through one, Rigcheck may earn a commission at no cost to you. It doesn't change what this guide recommends. How we handle this.

Mailtrap does two different jobs. Email Testing (the Sandbox) catches your app's email in a fake inbox during development, and it needs no DNS setup at all. Email Sending delivers real email to real people, and before it will send from your domain, you have to prove you own it and authenticate it with DNS records.

This guide covers the second one. Mailtrap gives you five records to add, then runs a short compliance check. Expect about 15 minutes of work, plus waiting for DNS and the review.

See what's already in place. Rigcheck shows your SPF, DKIM and DMARC records, and detects Mailtrap's DKIM keys once they're published.

Before you start

  • A Mailtrap account. If your account has a domain marked Demo, it can only send to the address you registered with. To email anyone else, you need your own verified domain.
  • Access to your DNS host, wherever your domain's DNS records are managed (Cloudflare, GoDaddy, Namecheap, Route 53 and so on). This isn't always where you bought the domain. Rigcheck shows your DNS host at the top of your results.
  • A decision on which domain to send from. Many teams send app email from a subdomain like mail.yourdomain.com, which keeps its reputation separate from your team's everyday email. Mailtrap treats a subdomain as its own sending domain, so add whichever one will appear in your From address.

Step 1: Add your domain in Mailtrap

No account yet? Create one first: the same account gives you both Email Sending and the Email Testing sandbox.
Create a Mailtrap account

Then:

  1. In Mailtrap, open Domains in the left menu (older accounts may see Sending Domains) and click Add Domain.
  2. Type the domain you'll send from and click Add.
  3. Mailtrap opens the Domain Verification page, which lists every record you need, with its type, name and value.

If someone else manages your DNS, the same page can email them the instructions.

Step 2: Add the DNS records

Mailtrap asks for four CNAME records and one TXT record:

RecordTypeWhat it does
Domain verificationCNAMEProves you own the domain, and also sets up the bounce address that SPF is checked against
DKIM 1CNAMEName rwmt1._domainkey, pointing to Mailtrap's signing key
DKIM 2CNAMEName rwmt2._domainkey, a second key Mailtrap switches to when it rotates keys
TrackingCNAMELets open and click tracking links use your domain instead of Mailtrap's
DMARCTXTYour DMARC policy, if you don't already have one

Copy each name and value from Mailtrap rather than typing them. Some values are specific to your account, and a single wrong character keeps a record from verifying. Mailtrap shows a copy button when you hover over or tap each one.

Check the type next to every record and pick the same type at your DNS host. Adding a CNAME as a TXT record, or the reverse, is the most common reason a record stays Missing.

Getting the names right

Mailtrap usually shows short names like rwmt1._domainkey. Most DNS hosts add your domain automatically, so enter them exactly as shown. A few hosts want the full name instead, like rwmt1._domainkey.yourdomain.com. If you're not sure which yours expects, add one record, then look at how the host displays it in your record list. If it shows rwmt1._domainkey.yourdomain.com.yourdomain.com, the domain got doubled: edit the name back to the short form.

If your DNS is on Cloudflare

Set all four CNAME records to DNS only (grey cloud), not proxied. A proxied record hides the CNAME, and Mailtrap can't verify it.

If you already have a DMARC record

Keep your existing one and skip Mailtrap's. A domain can only have one DMARC record, and the one you have already covers mail sent through Mailtrap. If you're adding DMARC for the first time, start with p=none and tighten it once your reports look clean: DMARC p=none vs quarantine vs reject walks through it.

Step 3: SPF (no changes needed)

You don't need to add Mailtrap to your SPF record. SPF is checked against the hidden bounce address (the Return-Path), not the From address your recipients see. Mailtrap's domain verification CNAME puts that bounce address on a subdomain of yours that points at Mailtrap, so SPF passes there and lines up with your domain for DMARC.

Older Mailtrap instructions, and many guides copied from them, still tell you to add a Mailtrap include: to your main SPF record. With the current setup, that include does nothing for Mailtrap mail and uses up one of the 10 DNS lookups your SPF record is allowed. If it's already there and your domain is verified, you can remove it. See SPF too many DNS lookups if your record is getting crowded.

Step 4: Verify the records

Back on the Domain Verification page, click Verify DNS records. Each record's status changes from Missing to Verified as Mailtrap finds it. Some verify right away and others take longer. Mailtrap also re-checks automatically every hour, so you don't have to keep clicking.

Mailtrap says detection usually takes 15 minutes to a few hours, occasionally up to a day. If a record still shows Missing after a few hours, see DNS changes not showing up to check whether it's a caching delay or the record itself.

Step 5: Sender information and compliance check

Once the records verify, Mailtrap asks for business or personal details about who's sending. Fill it in accurately: Mailtrap uses it for legal compliance and may add it to the footer of marketing emails. You can only switch between business and personal once, so choose carefully.

Then Mailtrap runs an automatic review of the domain, usually within a few minutes. Some domains get a short questionnaire about your business and what you'll send, and a few go to manual review, which moves as fast as you answer Mailtrap's emails. You can only send to real recipients once the domain shows Verified.

Two things help the review go smoothly:

  • Use an inbox you actually read for your Mailtrap account. Mailtrap contacts that address if it has questions.
  • Add other domains your emails link to. If your messages link to another domain you own, Mailtrap asks you to add and verify that domain too, so your email isn't mistaken for phishing.

Step 6: Confirm it works

  1. Run your domain through Rigcheck. DKIM should show keys for rwmt1 and rwmt2, and DMARC should be in place.
  2. Send a test message through Mailtrap to a personal Gmail address. Open it, tap the three-dot menu and choose Show original. You should see PASS next to SPF, DKIM and DMARC, with your own domain listed for each.

Other problems

  • Emails work in testing but not live. The Sandbox and Email Sending use different credentials and hosts. Make sure your app uses the sending credentials from your verified domain, not the Sandbox ones.

Test emails before they reach real people

DNS records decide whether your email is trusted. They don't catch a broken template, a missing link or spammy wording.

Check your Mailtrap setup. See which records pass and get the exact fix for anything missing.

Check my setup

Browse all guides