Skip to content

Blog / All posts

AI support agent replying in-thread from the merchant's domain: how to set it up (2026)

The merchant's domain must authorize your sender (aligned DKIM or SPF so DMARC passes), the agent must receive the customer's Message-ID, and the reply must carry In-Reply-To and References. Three architectures compared, checked Dec 3, 2026.

Originally published

For an AI support agent to reply in-thread from the merchant's domain, three things have to be true. The merchant's domain authorizes your sender: DKIM signs with the merchant's domain, or SPF passes on a MAIL FROM under it, so DMARC passes. The customer's email reaches the agent with its Message-ID. The reply sets In-Reply-To and References from that Message-ID, keeps the subject with Re:, and goes out from the address the customer wrote to. Gmail and Yahoo require aligned SPF or DKIM plus DMARC from anyone sending over 5,000 messages a day, and Outlook.com rejects non-compliant high-volume mail with 550 5.7.515. You can get there through a helpdesk (Zendesk, Intercom), through the merchant's own mailbox (Gmail API, Microsoft Graph), or through an email API with one verified domain per merchant (Bavimail, AgentMail, Nylas Agent Accounts, Postmark, Mailgun).

We build Bavimail. Standards, mailbox provider rules and other vendors' setups come from their own documentation, checked on December 3, 2026.

What does sending "from the merchant's domain" require?

DMARC decides whether your reply counts as the merchant's. Under RFC 7489, a message passes when SPF or DKIM passes and the authenticated domain aligns with the domain in the From: header:

  • DKIM alignment: the signature's d= domain matches the From domain. In relaxed mode, the default, the same organizational domain is enough: d=merchant.com aligns with [email protected].
  • SPF alignment: SPF checks the envelope sender (MAIL FROM, or Return-Path). A bounce domain such as bounces.merchant.com aligns with [email protected] in relaxed mode.
  • Either one is enough. A message "satisfies the DMARC checks if at least one of the supported authentication mechanisms" passes on an aligned identifier.

If your service signs with its own domain and bounces to its own domain, nothing aligns. A merchant with p=quarantine or p=reject then asks receivers to junk or refuse the agent's replies.

The mailbox providers turn this into rules:

  • Google: every sender needs SPF or DKIM and a spam rate below 0.3%; above 5,000 messages a day to personal Gmail, SPF, DKIM, DMARC and a From domain "aligned with either the SPF domain or the DKIM domain" (Email sender guidelines).
  • Yahoo: the same for bulk senders, DMARC "with at least p=none", and relaxed alignment is acceptable (Yahoo sender requirements).
  • Microsoft: since May 5, 2025, Outlook.com rejects mail from domains sending over 5,000 a day that fail SPF, DKIM or aligned DMARC, with 550 5.7.515 (Microsoft).

What DNS records does the merchant add?

Every service asks for the same three kinds of record, under different names:

ServiceDKIMSPF alignmentDMARC
ZendeskCNAMEs zendesk1._domainkey and zendesk2._domainkey; keys rotate quarterlyinclude:mail.zendesk.com in the domain's SPF (SPF)The merchant's own
IntercomA CNAMEA return-path CNAME ("SPF aligned for DMARC")A TXT record
AgentMailTXT selector recordsA dedicated MAIL FROM subdomain, typically mail.your-domain.comRequired, with a rua=mailto: tag
Nylas Agent AccountsA TXT recordA TXT recordNot issued by Nylas; recommended separately
BavimailCNAME recordsA Return-Path (MAIL FROM) CNAME plus an SPF TXTA TXT record

The Bavimail row is from our domains guide.

How does the agent receive the customer's email?

Three ways, each with a cost:

  • Forwarding the existing [email protected] to the service. Zendesk and Intercom work this way, and the merchant's mailbox stays where it is.
  • An MX record on a subdomain, such as help.merchant.com, pointing at the provider. The root domain's MX stays with whatever hosts the merchant's mail today, and agent mail builds its own reputation; Nylas recommends a dedicated subdomain for the same reason (Nylas). Customers write to the subdomain address.
  • Reading the merchant's mailbox through the Gmail API with Pub/Sub push or Microsoft Graph change notifications (see alternatives to polling Gmail over IMAP). Replies then go out from that mailbox and count against its limits: 2,000 messages a day per Workspace user (Google).

How does the reply stay in the same thread?

The reply needs In-Reply-To set to the customer's Message-ID and References set to the earlier chain plus that Message-ID, with the subject kept and Re: added once. Send it from the address the customer wrote to, so their next reply comes back to the agent. Store Message-ID, In-Reply-To and References when each message arrives, and never thread by subject. Some APIs build the headers from a message or thread id, others make you set them; the comparison is in keep email threading when an AI agent replies by API.

Which setup fits which support team?

SetupReplies come fromBest whenWatch out for
Helpdesk (Zendesk, Intercom) with its AI agent[email protected]Human agents work the same ticketsThe AI runs inside that helpdesk's product
Merchant's mailbox via Gmail API or GraphThe real mailboxReplies must sit in the merchant's own Sent folderOAuth consent per merchant, watch renewals, per-mailbox sending limits
Email API, one verified domain per merchantAn inbox on the merchant's domain or support subdomainYou run one agent for many merchantsEach merchant must publish DNS records

What should the agent check before it replies?

  • Whether the sender is real. A request to change an address or issue a refund should come from mail that passed DMARC. Bavimail returns SPF, DKIM, DMARC, spam and virus verdicts on every inbound message (inbound).
  • Quoted history. Bavimail's body_text is the full body as sent, including any history the customer's client quoted.
  • Instructions inside the email. Bavimail doesn't screen inbound mail for prompt injection. Treat the body as untrusted data, not as instructions.
  • Duplicates. Webhooks can be delivered more than once. Record event_id so the agent never answers twice (webhooks).

Where Bavimail fits, and where it doesn't

Bavimail fits the third setup, one agent serving many merchants:

  • One domain per merchant, one API key. Add each merchant's domain or support subdomain with POST /domains; Bavimail generates its SPF, DKIM, DMARC and MAIL FROM records and verifies them automatically (domains). Then POST /inboxes creates [email protected] (agent onboarding).
  • Inbound as a signed webhook. Customer mail arrives as email.inbound.received, signed with HMAC-SHA256, with a 100-character preview. GET /inbound-emails/{email_id} returns the full message. Messages are stored before the webhook and kept until you delete the thread (inbound).
  • Threading built for you. Pass the inbound message's thread_id and its message_id as in_reply_to, and Bavimail writes In-Reply-To and References:
const inbound = await client.inboundEmails.get(emailId)

await client.emails.send({
  inboxId: inbound.inboxId,
  threadId: inbound.threadId,
  inReplyTo: inbound.messageId,
  toEmails: [inbound.replyTo ?? inbound.fromAddress],
  subject: /^re:/i.test(inbound.subject) ? inbound.subject : `Re: ${inbound.subject}`,
  body: replyHtml,
})
  • Priced per domain, not per inbox. Developer is $5 a month for 50,000 emails, 10 domains with 10 inboxes each; Startup is $50 a month for 300 domains, 300 inboxes per domain and 300,000 emails a month. The Free plan has no custom domain, so it has no inbox (pricing).
  • MCP. An agent on the hosted server at https://mcp.bavimail.com/ (OAuth, 92 tools) makes the same calls.

Where it doesn't fit:

  • It's an email API, not a helpdesk. If the merchant's human team needs ticket queues alongside the AI, a helpdesk is the better home.
  • It doesn't send from the merchant's existing Gmail or Outlook mailbox. Replies come from an inbox on a domain verified with Bavimail, not from the merchant's Sent folder.
  • The merchant has to publish DNS records. Until their domain verifies, the agent can't send from it.

Next: verify a domain, then receive replies and answer in the thread.

← All posts