# Set Up an Email QA Pipeline

Use a dedicated sandbox inbox to receive messages from your test application. Sandbox addresses receive real email, and outbound sends can reach real recipients. Use addresses you control and keep test credentials separate from production.

## Create a test inbox

```bash
curl -X POST https://getmail.bot/v1/inboxes \
  -H "Authorization: Bearer $MAILBOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"username":"email-qa"}'
```

Save `data.id` and `data.address`. Configure your application's test flow to send its welcome or verification message to that exact address.

## Wait for the message

Set `INBOX_ID` to the saved ID. Capture the test start time and pass it as `after` to avoid accepting an old message:

```bash
curl --get "https://getmail.bot/v1/inboxes/$INBOX_ID/messages/wait" \
  -H "Authorization: Bearer $MAILBOT_API_KEY" \
  --data-urlencode "direction=inbound" \
  --data-urlencode "subject_contains=Welcome" \
  --data-urlencode "timeout_ms=30000" \
  --data-urlencode "after=$TEST_STARTED_AT"
```

Set `TEST_STARTED_AT` to an ISO 8601 timestamp before triggering your application. Assert the returned sender, subject, body, and message time in your test runner. A timeout should fail the test and preserve diagnostics without exposing credentials or private email content.

## Cleanup

Disable the test inbox when finished:

```bash
curl -X DELETE "https://getmail.bot/v1/inboxes/$INBOX_ID" \
  -H "Authorization: Bearer $MAILBOT_API_KEY"
```

Inbox and account limits still apply. Data retention depends on the plan, so save the evidence needed for a failing test. Sandbox engagement is delivered-only; do not use missing open or click events as a test failure on that tier.

See [Quick Start](/docs/quick-start) for outbound testing and [Inboxes](/docs/concepts/inboxes-model) for address and limit behavior.
