How do I know when an email is opened?
Use open tracking. When you send with track_opens, AgentMail adds an invisible 1x1 pixel to your HTML body, served from your own domain. The first time a recipient’s mail client loads that pixel, the message is marked as opened.
You see the open in three places:
- the
openedlabel on the message and its thread, which you can filter on - the message’s
opened_attime - the
message.openedevent, pushed to your webhook or WebSocket
Open tracking is included on every plan at no extra cost. Setting it up takes three steps:
- Turn it on for a custom domain. In the AgentMail Console, open Domains, choose View DNS records from the domain’s actions menu, and turn on the Open tracking switch. Or set
tracking_enabledwhen you create or update the domain through the API. - Publish the
link.<domain>CNAME at your DNS provider, set to DNS only (not proxied), and wait for the domain’stracking_statusto beVERIFIED. - Send with
track_openson a message that has an HTML body.
Opens are a directional signal. Mail clients that block images miss opens, and Apple Mail Privacy Protection, Gmail, and security scanners load images on their own, often within seconds of delivery. Only the first open of each message is recorded.
For code samples in Python and TypeScript, DNS troubleshooting (proxied records, CAA records), webhook handling, and current limits, see the Open Tracking guide.
