Email deliverability for AI agents
Agent email lands when it comes from a domain with SPF, DKIM and DMARC, goes to addresses that exist and expect it, leaves at a steady and modest pace and draws few spam reports. Agents add risks of their own: guessed addresses, reply loops and retried sends. Your code should stop all three.
Updated
What decides whether an agent's email lands?
- Authentication. Can the receiver tell the mail came from your domain?
- Reputation. How your domain and sending addresses behaved before.
- Spam reports. How often recipients press the button.
- Bounces. How often you write to addresses that do not exist.
- The message. An honest sender and subject, and content the recipient expects.
The receiver makes the final call. You control what it has to judge.
Which DNS records does an agent's domain need?
SPF lists who may send for the domain, DKIM signs each message, and DMARC ties both to the From address. SPF, DKIM and DMARC has sample records. Check what is published:
dig +short TXT agents.trotta.io # SPF: a line that starts v=spf1
dig +short TXT _dmarc.agents.trotta.io # DMARC: starts v=DMARC1The DKIM key sits at selector._domainkey under your domain, and your mail service names the selector. A subdomain for agents keeps their mail easy to tell apart and to switch off.
What do Gmail and Outlook.com require from senders?
| Rule | Gmail, every sender | Gmail, over 5,000 a day | Outlook.com, 5,000 or more |
|---|---|---|---|
| Authentication | SPF or DKIM | SPF, DKIM and DMARC | SPF and DKIM both pass, with DMARC |
| From alignment | Not listed | SPF or DKIM domain matches From | SPF or DKIM domain matches From |
| Reverse DNS and TLS | Required | Required | Not on the page cited |
| Spam rate in Postmaster Tools | Below 0.3% | Below 0.3% | Not on the page cited |
| One-click unsubscribe | Not listed | Marketing and subscribed mail | Not on the page cited |
Gmail's rules cover mail to personal Gmail accounts. Microsoft's cover high volume senders to its consumer mail services, which refuse failing mail with 550 5.7.515. Google also advises a consistent rate without bursts, and raising volume slowly.
What goes wrong with AI agents in particular?
| Risk | What happens | Control in code |
|---|---|---|
| Guessed addresses | Bounces pile up | Write to addresses you were given or that wrote to you |
| Reply loops | Two autoresponders answer each other all night | Do not auto-answer automated mail, and cap replies per thread |
| Retries | A timeout and a retry send twice | One idempotency key per task and recipient |
| Bursts | A quiet domain suddenly sends a flood | A daily cap well under the provider's |
| Fake replies | Re: on a new message misleads | Never add it. Gmail's guidelines say so |
| Ignored opt-outs | Spam reports | Store each one and check it before every send |
RFC 3834 says automatic responses should not answer a message whose Auto-Submitted header has any value other than no. On Trotta Mail, check extracted.is_automated before an agent replies.
How should an agent send so a retry is harmless?
Derive the key from the task, not from the wording. A model rarely writes the same text twice, and the server answers 409 idempotency_key_reused instead of sending a second version.
import hashlib
from trottamail import TrottaMail, TrottaMailError
mail = TrottaMail() # reads TROTTA_MAIL_API_KEY
def send_once(inbox_id, task_id, to, subject, text):
key = hashlib.sha256(f"{task_id}:{to}".encode()).hexdigest() # same task, same key
try:
msg = mail.messages.send(inbox_id, to=to, subject=subject, text=text, idempotency_key=key)
except TrottaMailError as err:
if err.code == "idempotency_key_reused":
return "already sent for this task" # a retry with different wording
if err.code == "recipient_suppressed":
return "do not write to this address"
raise
if msg["status"] == "pending_approval":
return "waiting for a human"
return msg["delivery"]["state"] if msg["delivery"] else msg["status"]Run locally, a repeat returned the original message, a reworded repeat was refused, and a first contact under approval waited for a human.
What should happen when mail bounces or is reported?
Stop writing to that address, and find out where it came from. A rising bounce rate usually means a bad source of addresses. A spam report means the recipient did not expect you. Slow down before you try anything else.
What does Trotta Mail do about deliverability?
These rules for mail to outside addresses come from the API reference. Mail between Trotta Mail inboxes is not subject to the warm-up or own domain limits.
| Area | What happens |
|---|---|
| Your own domain | Until its sending records are published and seen, outside sends answer 409 own_domain_outside_not_open |
| Unclaimed agents | Replies only |
| New Free organizations | 3 new outside addresses to start conversations with in the first 24 hours |
| Warm-up | Daily caps on outside recipients while the sending service warms up: 429 sending_warming_up |
| Daily caps | 50 unclaimed, 100 Free, 1,000 Developer, 10,000 Startup, counted by recipient |
| Dead addresses and complaints | They join your suppression list, and later sends answer 409 recipient_suppressed |
| Too many complaints | Outside sending pauses: 403 outside_sending_paused |
| Outcomes | delivery.state per message, and message.bounced and message.complained events |
| Outbound screening | Mail is checked before it leaves, and held mail waits for a human |
The send call has no field for custom headers such as List-Unsubscribe, so it is not the tool for bulk marketing mail. Consent, content and list quality stay with you. Your own domain needs a paid plan: see custom domain email for agents.
Questions
Why do my AI agent's emails go to spam?
Check authentication first, then who you are writing to. Unaligned mail, recipients who never asked and sudden bursts are common causes.
How many emails can an agent send in a day?
As many as your provider's cap and your reputation allow. On Trotta Mail the daily caps are 100 on Free, 1,000 on Developer and 10,000 on Startup.
Does a new domain need warming up?
Yes, in the sense that volume should grow slowly. Google warns that sudden spikes from a sender without that history can lead to rate limits or reputation drops.
Can an agent send cold outreach?
Rules differ by country, so check the law that applies to you. Gmail asks senders to write only to recipients who want the mail.