Email verification looks like a small feature until the provider times out after accepting a message, a worker crashes between two writes, or a user clicks “send again” several times. At that point, the real problem is not generating a token. It is making delivery attempts safe to repeat.
The pattern I prefer is an idempotent verification job backed by PostgreSQL. The API records one verification intent, the outbox records one logical delivery, and workers can retry that delivery without creating a new token or an uncontrolled number of messages. The model is simple enough to inspect during an incident, which is important when the failure are intermittent.
This is also where the choice of test inbox matters. A throwaway email address can be useful for a controlled staging check, but it should never become the consistency mechanism for production authentication.
Why idempotency belongs in the data model
An HTTP retry is normal.…