Testing Workflows
Common ways to use MailtestAPI in end-to-end and smoke-test pipelines.
Typical flow
- Trigger the product behavior that sends an email.
- Poll
GET /v1/emailsby recipient until the expected message appears. - Fetch
GET /v1/emails/{emailId}for full body content. - Assert on subject, sender, links, HTML fragments, or raw headers.
- Mark or delete the message after the test completes.
Good polling strategy
- filter by exact recipient where possible
- keep
limitlow - stop polling as soon as the expected subject or sender matches
- use the returned
receivedAtto avoid stale-message assertions
Useful patterns
Signup confirmation
- trigger account creation
- poll by recipient
- assert that the confirmation link exists in
body.htmlorbody.text
Password reset
- trigger reset flow
- fetch the latest matching email
- parse the reset URL from the message body
Internal notifications
- send a test event
- verify labels, headers, or notes after downstream processing
Cleanup
If your tests create lots of captured mail, call DELETE /v1/emails/{emailId} when assertions are complete or periodically prune messages in teardown jobs.