Group
  • Testing

    Mock email sending so I can test my email flows

    Intercept outbound email in tests to verify the right messages go out with the right content, without sending real mail.

    • Improve quality
    • Automate workflows
    • Beginner
    • General

Free Prompt

My app sends transactional email (signup confirmations, password resets, receipts, notifications) and I want tests proving the right emails go out, without sending real email. First, find every place my app sends email and list the triggers: what user action or system event causes each email. Then set up an email interception layer for tests that: 1. Captures outbound email instead of sending it, recording recipient, subject, and body. 2. Works regardless of which email provider or library my app uses. 3. Lets a test inspect the captured messages and clear the outbox between tests. Write tests for each email trigger asserting: the email goes to the correct recipient, the subject and key body content are right (including any links, tokens, or amounts), and no email is sent when the triggering condition fails (for example, no receipt email when a payment fails). Also check for the classic mistake: emails that contain broken links because of missing or hardcoded base URLs. Flag any email whose links point at localhost or a placeholder domain. When finished, run the suite and summarize which email flows are verified and which ones have no coverage.

What This Does / How This Helps

This intercepts your app's outbound email in tests and verifies the right messages reach the right people with the right content, including links and amounts. Email bugs are silent. A password reset email with a broken link or a receipt with the wrong amount doesn't throw an error anywhere; it just confuses a customer. Testing email flows catches the localhost-link mistake that nearly every vibe-coded app ships with at least once.

Want to skip doing this by hand?

Fortivibe audits your app for all of the areas these prompts cover (and more).

See What We Check

Related Prompts