Agents · 2026 · Jasa
Email the AI, and it writes back
Ask a question just by emailing [email protected], no app needed. Calling the model was easy; the hard parts were deciding whom to trust and not retrying forever when something fails.
The oldest interface
Email needs no install and is on every device. So I wanted AI to live in a mailbox: send a question and the answer returns in the same thread. The service is one Cloudflare Email Worker that calls my own gateway.
Senders can be forged
Anyone can write any envelope address, so checking it alone gives my quota to the whole world. Beyond the allowlist, I also read the verification result the receiver recorded:
- Trust only the
Authentication-Results. header Cloudflare added. Use the top one, since lower ones may be written by the sender. - DKIM domains must match exactly. With suffix matching,
trusted-domain.evil.examplewould pass too. Fromheader must match too. A trusted address in the display name does not count.
Do not start chatting with bots
Auto-replies, bounces and mailing lists must be ignored, or two bots will answer each other until dawn. Replies also carry Auto-Submitted: auto-replied, marking them as automatic. The body is treated strictly as a question, not an instruction: nothing in a message can change the system rules.
The most expensive bug
Once the model answered but the reply failed to send. The code rethrew the error, the mail platform saw a failed delivery and retried about every 30 seconds, calling the model each time. No reply arrived, yet quota kept draining.
This time I learned: before writing retries, work out which step is the most expensive. If a cheap later step fails, it shouldn't force the expensive one to run again.
