---
title: E-mail flows: capture the message next to the screen that sent it
description: Sign-up confirmation, order receipt, password reset. Kaloko captures the e-mail from Mailpit or letter_opener as a step of the flow, checks its subject and links, and shows it on the canvas next to the form.
seo_title: E-mail flows: the message next to the screen that sent it
seo_description: Sign-up confirmation, receipt, password reset: Kaloko captures the e-mail as a step, checks subject and links, shows it next to the form.
query: testing e-mail flows with an AI agent
kind: use-case
order: 4
demo: false
---
The form works. The e-mail says "Hello {{first_name}}". Every team has shipped this once. Kaloko makes the message a step of the flow, so people see it next to the screens around it.

## The problem

E-mails live outside the browser, so end-to-end tests skip them or assert on a subject string. Nobody sees the rendered message in both languages until a customer does.

## What changes with Kaloko

An `email` step in the scenario. `kaloko mail` waits for the message in the test mailbox (Mailpit on staging, letter_opener locally in Rails projects), captures it like a screen, and the criteria check subject, sender, links and copy. On the canvas the e-mail sits right after the form that triggered it.

## How it works

1. **Unique address per run**: `kaloko start` prints a test address (`qa+<run>@…`); the agent uses it in the form so the run finds its own messages.
2. **Trigger and capture**: after the form step, `kaloko mail --step confirmation --locale cs` waits for the message and stores it with rendered HTML and the plain text.
3. **Check it**: deterministic criteria on subject and links (the confirmation link must point at your host), a semantic question for tone and completeness, a screenshot for the humans.
4. **Review**: the reviewer sees the form and the e-mail side by side per locale and approves or returns them like any other step.

## Skills and prompts

```
Walk the sign-up flow on local including the confirmation e-mail in cs and en, and check that the link in the mail opens the account page.
```

Expected outcome: screens of the form and the account page, an e-mail step per locale with subject and sender, criteria on the link target, a shared canvas.

## What you get

- E-mails as ordinary steps of the run, checked and reviewed like the screens.
- Both mailbox styles supported: Mailpit over HTTP and letter_opener folders on disk.
- No production mail is ever sent: production is read-only in Kaloko.

## FAQ

### Which mailboxes are supported?

Mailpit (`mail.provider: mailpit` with its URL) and Rails letter_opener (`mail.provider: letter_opener`, folder `tmp/letter_opener`). Others via a small adapter; ask.

### Can the agent click the link inside the e-mail?

Yes: the message body is available to the step script, so a Playwright step can open the link and the next screen becomes a step of its own.
