Guide / Contacts
How to verify email before an agent sends: syntax, MX, catch-alls
Parse the address, resolve its domain and stop before probing mailboxes. Verification rules out broken routes; it never proves a reader or permission.
Before an agent sends, check the address's syntax and its domain's mail routing, then keep mailbox existence and permission as separate decisions. With an address parser and an HTTPS client, you can reject malformed inputs and clear routing failures without turning a passing check into a claim that a person reads the address.
How to verify email before an agent sends
- Use a maintained parser to extract the mailbox from any display-name wrapper, then validate it for the SMTP envelope. The message-format grammar includes header forms that are more than a bare destination; taking everything between the first angle brackets is not a substitute for parsing.
- Preserve the local part, including its case and plus tags: SMTP leaves its meaning to the destination, while domains compare without regard to case. For syntax-only examples,
billing+invoices@example.comfits the grammar, whereasbilling..team@example.comhas an invalid pair of unquoted dots; do not send to either. - Handle non-ASCII local parts through an SMTPUTF8-capable path, rather than calling an unsupported format invalid. Convert internationalized domains to A-label form for DNS lookup.
- Query MX through Google's DNS JSON API and inspect Status, TC and the requested record type in Answer. HTTP success is not DNS success: distinguish a nonexistent domain from temporary failure, and keep truncated or failed responses unknown while applying your own bounded retry policy.
- Stop on a single MX record with data
0 .: null MX explicitly declines mail. Ordinary MX records instead advertise mail hosts, whose address resolution belongs to the sending transport; unusable MX hosts do not permit fallback to the original domain's web address. - Follow a CNAME by restarting the MX lookup at its target. A successful lookup with no MX uses the domain itself as an implicit mail exchanger, so check A/AAAA; if that implicit exchanger cannot resolve to an address, it is unusable.
- Stop before mailbox probing and leave mailbox existence unknown. If you already know the domain has catch-all routing, retain that qualification: incorrect or nonexistent names can reach another mailbox, so acceptance cannot identify the intended recipient.
- Store format, routing, mailbox status and permission separately, along with what you checked and when. Our recommendation is to refresh routing before sending, rather than treating an old result as a permanent property of the address.
- Put the actual send behind a separate gate for permission and context, suppression, authentication and sending limits. A pass through syntax and DNS must not bypass any of those decisions.
Example calls
An MX lookup asks about a domain, not an individual mailbox. This request found advertised mail hosts for gmail.com.
GET https://dns.google/resolve?name=gmail.com&type=MX
The response had Status 0 and TC false; selected fields below show one returned MX record.
{"Status":0,"TC":false,"Answer":[{"type":15,"data":"5 gmail-smtp-in.l.google.com."}]}
That is a route advertised in DNS, not evidence that any particular mailbox exists or that the host will accept your message.
The next request illustrates why an empty MX answer needs another step:
GET https://dns.google/resolve?name=www.google.com&type=MX
It returned Status 0 and TC false, with no Answer field; an Authority section was present. These are selected fields, not the complete response:
{"Status":0,"TC":false}
That result is not a declaration that the domain refuses email. SMTP's implicit-MX rule calls for address resolution, which the next requests performed on the same name.
GET https://dns.google/resolve?name=www.google.com&type=A
GET https://dns.google/resolve?name=www.google.com&type=AAAA
Both returned addresses; the following two lines select one record from each response.
{"name":"www.google.com.","type":1,"data":"142.251.150.119"}
{"name":"www.google.com.","type":28,"data":"2001:4860:482b:7700::"}
Those are addresses a sending transport could try under the fallback rule, not proof of an SMTP listener. RFC 7505 specifically explains that an A/AAAA address may exist without accepting mail.
An explicit refusal looks different:
GET https://dns.google/resolve?name=example.com&type=MX
The lookup returned a single MX with data 0 .; selected fields show the distinction from an empty answer.
{"Status":0,"TC":false,"Answer":[{"type":15,"data":"0 ."}]}
This domain advertises no mail service. The example.com addresses above are illustrations of syntax, not working inboxes.
What it costs
Google describes Public DNS as free: the service price is $0 per lookup.
The MX, A and AAAA queries are separate requests, and following a CNAME requires another lookup. Budget separately for your client, logging and retries; those are your operating costs, not a DNS service charge. This is a way to inspect routing, not a paid mailbox-verification product.
When this is the wrong tool
Stop here if the question is whether this is the right person. DNS cannot establish that connection. A catch-all makes the weakness particularly clear: the provider can collect mail addressed to a name that has no individual account, so a binary valid result has lost its value as evidence of that mailbox's existence.
The obvious objection is that an SMTP server could settle the question by accepting the recipient. But RFC 5321 permits recipient checks to be deferred until message data arrives; a positive reply before that point is not final delivery. Even acceptance after message data means responsibility for delivery or relay, with later failures still possible.
The protocol's verification command has different semantics: a conforming 250 response requires actual verification, not a syntax check alone. Sites may restrict verification for security and return 252 instead. The RFC discusses address harvesting and the value of keeping such tools inside an administrative domain; our recommendation is to leave third-party probes out of the agent's pre-send pipeline.
Permission remains another question. Gmail advises against purchased addresses and messages to people who did not subscribe; Yahoo asks for requested mail and prompt removal of invalid recipients, with bounce monitoring. Neither is a reason to turn a verification result into permission for outreach.
For a receipt or another transactional message, use the recipient established for that transaction. The buyer remains responsible for lawful use of contact data. Before enabling sends, apply the authentication and suppression controls in our Gmail, Yahoo and Outlook sender-rules guide; syntax, routing and provider compliance still promise no inbox placement.
Frequently asked questions
Does an MX record prove a mailbox exists?
No. It advertises a mail host for the domain, not the existence of an individual mailbox or a human reader.
Does no MX mean the domain cannot receive email?
Not by itself. A successful lookup without MX uses SMTP's implicit-MX fallback, which requires the domain to resolve to an A or AAAA address.
Is null MX the same as an empty MX answer?
No. Null MX is a single MX record with preference 0 and target . that explicitly declares no mail service.
Can these lookups identify a catch-all domain?
No. Their results describe DNS routing and give no evidence of what the provider does with an unknown recipient name.
Should an agent add an SMTP probe to finish verification?
Our recommendation is no. Restricted verification, deferred recipient checks and catch-all routing limit what a reply can establish; none proves a person reads the address.
Read this article as Markdown Open in ChatGPT Open in Claude


