Your Playwright test clicks "Reset Password." An email gets sent. Now what?
Most teams fake this with mocked SMTP or MailHog. Tests pass locally but break in staging because the email never actually arrived. There's a better way.
Create a Real Test Inbox
brew install nylas/nylas-cli/nylas
nylas init
nylas inbound create e2e-test
nylas inbound create provisions a managed email address that receives real email. No MX records. No mail server.
Poll for Messages in Your Test
nylas inbound messages checks for new mail:
nylas inbound messages inbox_abc123 --unread --json --limit 1
Parse the JSON output to extract reset links, verification codes, or confirmation emails.
Monitor in Real Time
nylas inbound monitor streams messages as they arrive:
nylas inbound monitor inbox_abc123 --tunnel cloudflared
Extract OTP Codes
Testing two-factor auth? nylas workflow otp list extracts one-time passwords:
nylas workflow otp list --limit 1
List All Test Inboxes
nylas inbound list shows your managed addresses:
nylas inbound list --json
Why Not MailHog?
MailHog intercepts SMTP locally — your app must be configured to send through it. Nylas Inbound addresses receive email through real infrastructure. If it arrives here, it'll arrive in Gmail too.
CI Integration
- name: Install Nylas CLI
run: curl -fsSL https://cli.nylas.com/install.sh | bash
- name: Run E2E tests
env:
NYLAS_API_KEY: ${{ secrets.NYLAS_API_KEY }}
run: |
nylas auth config --api-key $NYLAS_API_KEY
npx playwright test
Webhook Testing
nylas webhook test send fires test events:
nylas webhook test send https://staging.myapp.com/hooks/email
nylas webhook server starts a local receiver:
nylas webhook server --port 4000
All commands: Nylas CLI Command Reference
Get started: brew install nylas/nylas-cli/nylas — other install methods
Top comments (0)