EmailClient that lets you test email workflows in your
application. It generates unique email addresses and waits for incoming emails,
making it easy to test OTPs, invite flows, and notification emails.
All test repositories managed by Empirical have this built-in — no additional
setup is required.
Usage
Dynamic email
Generates a random email address that can be used for the test (e.g. invite a new user).Static email
Uses a known (static) email address that can be used to login into an application. The email id is appended with a managed domain to get the full email address.Filtering emails
You can filter emails by sender, subject, or body content. Thesubject and
body filters use substring matching, so you don’t need to provide the full
value. The from filter requires the full email address.
Email properties
The received email object has the following properties:| Property | Type | Description |
|---|---|---|
subject | string | Email subject line |
text | string | Plain text body |
html | string | HTML body |
links | { text?: string; href?: string }[] | Links found in the email |
codes | string[] | Verification codes extracted from the email |
Options
| Option | Type | Default | Description |
|---|---|---|---|
emailId | string | Random | A specific email id to use instead of generating a random one |
timeout | number | 30000 | Timeout in milliseconds to wait for the email |