From SMTP capture to an assertion
Your application sends through SMTP. Your test suite reads the result through HTTPS. Create an API key in Developer API, store it as a secret, and choose read-only access unless your suite needs to create inboxes or delete messages.
- Generate a unique test recipient.
- Trigger the action in your application.
- Wait for the matching email in the selected inbox.
- Fetch the message body or metadata and assert the result.
Wait for the email you triggered
curl --fail-with-body --get \
"https://api.smtpbox.dev/v1/inboxes/$SMTPBOX_INBOX_ID/messages/wait" \
-H "Authorization: Bearer $SMTPBOX_API_KEY" \
--data-urlencode "to=$TEST_RECIPIENT" \
--data-urlencode "subject=Reset" \
--data-urlencode "timeout=20"Set the three environment variables before running this request. A successful response has success: true and the matching message under data. Its uid identifies the message. A wait timeout returns HTTP 408; an invalid key returns 401.
Read the content you need
Fetch GET /v1/messages/{uid} for metadata and links, or GET /v1/messages/{uid}/text for a JSON response containing data.content. HTML and raw MIME use the same body endpoint with html or raw.
Make parallel tests reliable
The wait endpoint searches the latest 50 messages and matches recipient and subject substrings. Use a unique full recipient for every run, separate busy suites into inboxes, and keep test bursts small enough that a message cannot disappear from that window. The wait timeout is limited to 25 seconds.
Message capture and body processing are separate steps. If your test needs a body or extracted links, wait for processed_at before inspecting them. The Playwright example handles this explicitly.
Control test data and usage
Free workspaces include 600 API requests per hour; Unlimited includes 3,000. Reuse a waiting request instead of repeatedly polling at high frequency. Read/write keys can delete a specific message after a test; avoid clearing a shared inbox while other tests are running.
For event-driven integrations, use signed message webhooks. SMTPBox is a capture and inspection API, not a production email delivery API.
Start with a free inbox
Free includes 2,500 captured emails per month and 7-day retention. Unlimited is £14.99 per month with 30-day retention, subject to fair use.
Create your SMTPBox account Compare plans
