Skip to navigation

Understanding Email Authentication (SPF, DKIM, DMARC)

When you add a custom domain to AgentMail, we ask you to add several records to your DNS settings. We understand that this can seem daunting, and we want to be completely transparent about what these records are and why they are necessary.

In short, by adding these records, you are giving AgentMail permission to do two things:

  1. Send emails on your behalf that are trusted and pass spam filters.
  2. Receive emails for you so your agents can process them.

This process is standard practice for any third-party email service, and it does not give us control over your website or any other part of your domain. Let’s break down what each piece does.

The Pillars of Email Authentication

To prevent spam and phishing, the modern email ecosystem relies on three core technologies: SPF, DKIM, and DMARC. Our goal is to handle all the complexity of these protocols for you.

Your DNS records are simply the way you tell the world that you’ve authorized us to do so.

SPF: Sender Policy Framework

  • What it is: Think of SPF as a public list of all the servers that are allowed to send email for your domain.
  • How it works: You add a TXT record to your DNS that lists the approved IP addresses or domains. Receiving servers check SPF against the envelope sender (the Return-Path, also called MAIL FROM) rather than the visible From address. AgentMail sends your email with a MAIL FROM address on mail.domain.com, so that is where the SPF record goes. If the server that sent the email is on that list, the check passes. This is what a record we give you looks like:
  • Your Record:
    TXT | mail.domain.com | v=spf1 include:amazonses.com -all
    AgentMail sends through Amazon SES, so this record tells the world that Amazon SES servers are authorized senders for the mail.domain.com subdomain. The -all part says that any server not on this list should be considered unauthorized. Because the record lives on mail.domain.com, it never touches an SPF record you already have on domain.com for another email service.

DKIM: DomainKeys Identified Mail

  • What it is: DKIM is like a digital signature for your emails. This signature proves two things: that the email actually came from your domain and that its content hasn’t been messed with with in transit from you to who you are trying to send to.
  • How it works: We generate a unique, secure key for your domain. When we send an email, we “sign” it with this key. The public part of that key is published in your DNS. Receiving servers use this public key to verify the signature.

This is the kind of record we might ask you to add.

  • Your Records:
    TXT | b4w..._domainkey.payment... | v=DKIM1; k=rsa; p=MIIB...
    AgentMail gives you a custom DKIM selector host and TXT value. Publishing the key directly at that selector gives receiving servers a precise public key to verify signatures from your domain.

Legacy orgs should keep existing working DNS records in place. For new domain setup, add the TXT selector records AgentMail returns.

DMARC: Domain-based Message Authentication, Reporting, and Conformance

  • What it is: DMARC is the policy that ties SPF and DKIM together. It tells receiving email servers what to do if an email claims to be from you but fails the SPF or DKIM checks(or both).
  • How it works: You publish a TXT record that specifies your policy. You can tell servers to reject the message, quarantine it (mark as spam), or do nothing. It also allows you to get reports on which emails are passing and failing these checks.

We typically tell servers to reject the message as this increases deliverability(as you can see, this is something we’ve done our research on!)

  • Your Record:
    TXT | _dmarc.domain.com | v=DMARC1; p=reject; rua=mailto:dmarc@agentmail.to
    This policy tells servers to reject any email that fails authentication. The rua tag specifies that aggregate reports about these failures should be sent to dmarc@agentmail.to, allowing us to monitor your domain’s health and deliverability on your behalf.

Receiving Mail: The MX Records

Finally, to receive emails for your agents, you need to tell the internet where to deliver them. This is the job of the MX (Mail Exchange) records.

  • What they are: MX records are the post office address for your domain’s email.
  • How they work: When someone sends an email to your-agent@your-domain.com, their mail server looks up the MX record for your-domain.com to find out where to send it.

These are the records we give you for a US-region domain (EU-region domains use eu-central-1 in place of us-east-1):

  • Your Records:
    MX | domain.com | 10 inbound-smtp.us-east-1.amazonaws.com
    MX | mail.domain.com | 10 feedback-smtp.us-east-1.amazonses.com
    The first record directs all incoming mail for your domain to our servers, so we can ingest it and trigger your agents. If you create the domain as send-only (inbound_enabled set to false), we leave this record out and your existing email provider keeps receiving your mail. The second feedback-smtp record is specifically for routing automated feedback, like bounce and complaint notifications from other mail servers, which is crucial for maintaining a healthy sender reputation. It must be the only MX record on mail.domain.com.

The Full Record Set

AgentMail returns the exact records for your domain in the AgentMail Console and in the records array of the Create Domain response. Always copy the values shown for your domain. For a US-region domain named example.com, the full set looks like this:

PurposeTypeName (host)ValuePriority
ReceivingMX@inbound-smtp.us-east-1.amazonaws.com10
Bounces (MAIL FROM)MXmailfeedback-smtp.us-east-1.amazonses.com10
SPF (MAIL FROM)TXTmailv=spf1 include:amazonses.com -all
DKIMTXT<selector>._domainkeyv=DKIM1; k=rsa; p=... (your public key)
DMARCTXT_dmarcv=DMARC1; p=reject; rua=mailto:dmarc@agentmail.to
  • SPF lives on mail.example.com, not your root domain. AgentMail sends with a custom MAIL FROM subdomain, and SPF is checked against that hostname. Do not add anything to an existing SPF record on your root domain (for example one for Google Workspace or Microsoft 365).
  • The mail MX must be the only MX record at mail.example.com. If another MX record exists at that host, verification reports duplicate_records. This record carries bounces and complaints; it does not receive inbox mail.
  • DMARC needs a reporting address. If _dmarc.example.com already has a DMARC record, keep that single record instead of adding a second one, and make sure it includes a rua=mailto: tag.
  • DKIM needs exactly one TXT record at the selector host. Remove any older record at the same selector.
  • Send-only domains: create the domain with inbound_enabled set to false and the receiving MX is left out, so your existing provider keeps receiving mail.
  • Region: EU-region domains use eu-central-1 in the MX values in place of us-east-1.
  • Subdomains: names are relative to your DNS zone. For agents.example.com, the hosts become agents, mail.agents, _dmarc.agents, and <selector>._domainkey.agents.
  • Optional records: a link CNAME is added when tracking_enabled is on, and a wildcard * MX when subdomains_enabled is on.
  • Older domains may show three DKIM CNAME records (<token>._domainkey pointing to <token>.dkim.amazonses.com) instead of one DKIM TXT record. Keep them if they already verify.

We hope this provides a clear and transparent look into why these DNS records are required. By setting them up, you enable AgentMail to provide a secure and reliable email experience for your AI agents.