Email-driven tests become unreliable when every CI job shares one inbox. A retry can read an old verification message, a parallel build can consume the wrong code, and a failed cleanup can leave test data around for the next run.
The fix I use is to treat test email as a leased capability. A Docker job gets one short-lived mailbox, one correlation key, and one clear owner. The job can read only the messages for its run, then releases the mailbox when the test finishes. This makes a free temp email useful for automation without making the inbox a shared test database.
Why a mailbox lease belongs in the CI design
An email assertion has two separate jobs:
Prove that the application sent the expected message.
Prove that this CI run received and consumed its own message.
The first is a product check. The second is an isolation check. Mixing them creates green builds that are hard to trust.
The pattern is similar to keeping retry inputs immutable .β¦