Sign inGet Started

Test email delivery (mail sandbox)

Use the mail sandbox to test webhook handlers, suppression logic, and delivery outcomes without sending to a real inbox. Send through the normal API to an address at messagebird.dev. The local part determines the outcome. For example, bounce@messagebird.dev bounces and delivered@messagebird.dev delivers.

A sandbox message uses the normal acceptance, event, and webhook paths. It returns the same 202 response and produces the same per-recipient event payload shapes as a production message. The payload has no test flag. The message does not reach external delivery infrastructure or a real inbox. Simulated bounces and complaints do not affect sending reputation or write to the suppression list. You can reuse the addresses.

The sandbox does not require setup, a toggle, test mode, or a special API key. It triggers based on the recipient address across POST /v1/email/messages, POST /v1/email/batches, and broadcasts. When a contact in a broadcast audience uses a sandbox address, delivery is simulated instead of sent. You can rehearse a campaign without emailing real recipients. A simulated recipient still counts against your send allowance. Rehearsals exercise the same quota as real campaigns.

Magic addresses

All addresses are on @messagebird.dev. The local part selects the outcome:

AddressSimulated outcomeWebhook sequenceNotes
delivered@The receiving mail server accepts the messageemail.accepted → email.processed → email.deliveredThe happy path
bounce@ / hardbounce@Hard bounce: SMTP 550, 5.1.1 Unknown User, bounce class 10email.accepted → email.processed → email.bounced with bounce_type: "hard"Does not write to the suppression list. The address stays reusable.
softbounce@Soft bounce: SMTP 451, 4.3.0 Temporary failure, please retry, class 20email.accepted → email.processed → email.bounced with bounce_type: "soft"Soft bounces do not add to the suppression list, whether real or simulated.
deferred@ / delay@Deferral: SMTP 451, 4.2.1 Mailbox temporarily unavailable, will retry, class 21email.accepted → email.processed → email.deferredThe simulated deferral is terminal. No retry follows and the recipient stays deferred.
complaint@ / spam@The recipient reports the message as spam (feedback_type: "abuse")email.accepted → email.processed → email.complainedDoes not write to the suppression list. Reusable.
suppressed@The recipient is treated as already on your suppression listemail.accepted → email.rejected with rejection_reason: "recipient_suppressed"Short-circuits during processing like a real suppressed recipient. No email.processed or delivery events follow.
reject@The message is rejected before any delivery attemptemail.accepted → email.rejected with rejection_reason: "transmission_failed"No email.processed or delivery events follow.

The sequences above show the webhooks produced by a single message. Broadcasts omit the leading email.accepted webhook. Broadcast recipients are still accepted and recorded without firing an email.accepted webhook. Each broadcast sequence starts at the next event: email.processed on delivery paths or email.rejected for suppressed@ and reject@. All subsequent events are identical. See the event reference for full details.

A message can mix sandbox and real recipients. Each recipient follows a separate lifecycle. Real recipients deliver normally, while sandbox recipients are simulated.

The same events also appear on the message timeline in the email log and in the events API. You can use the sandbox without a webhook endpoint and read outcomes from those sources.

Addressing rules

  • Detection uses the local part on the messagebird.dev domain only. bounce@yourdomain.com is a normal address.
  • Only the local parts in the magic addresses table are magic. Any other address at messagebird.dev is a normal recipient. When you send from the shared onboarding domain, that address must belong to a verified workspace member.
  • Matching is case-insensitive: Bounce@messagebird.dev and bounce@messagebird.dev behave identically.
  • +label subaddressing is stripped before matching: bounce+signup-flow@messagebird.dev still bounces. Use labels to correlate test cases. The full address (including the label) appears in your events and webhooks so each test run can tag its recipients.

Walkthrough: simulate a bounce, end to end

You do not need a verified sending domain. Send from onboarding@messagebird.dev as described in Send your first email. Recognized sandbox addresses are exempt from the onboarding domain's verified-member restriction but still count toward its daily quota.

Make sure you have a webhook endpoint subscribed to email events (see Webhooks), then send:

const msg = await bird.email.send({
  from: { email: "onboarding@messagebird.dev", name: "Bird" },
  to: ["bounce+signup-flow@messagebird.dev"],
  subject: "Sandbox bounce test",
  html: "<p>This message will hard-bounce.</p>",
  tags: [{ name: "flow", value: "signup" }],
  metadata: { test_run: "docs-capture-1" },
});
console.log(msg.id, msg.status); // "em_…", "accepted"

If your key starts with bk_eu1_, call https://eu1.platform.bird.com instead.

The API returns 202 Accepted with an em_* message ID, indistinguishable from a production request. You test your real code path. Your webhook endpoint then receives email.accepted, email.processed, and email.bounced. Every event echoes the message's tags and metadata (null when omitted). The email.bounced payload includes the full bounce classification:

Code example
{
  "type": "email.bounced",
  "timestamp": "2026-07-23T14:51:00.362Z",
  "data": {
    "email_id": "em_01ky7qanhrejer0bn34v38hrxh",
    "recipient_id": "er_01ky7qanhrejds4decpk83q5qq",
    "workspace_id": "ws_01ky7m21hjffh9s8kq76gyb1xf",
    "recipient": "bounce+signup-flow@messagebird.dev",
    "recipient_role": "to",
    "bounce_type": "hard",
    "bounce_class": 10,
    "bounce_code": "550",
    "bounce_description": "5.1.1 Unknown User",
    "sending_ip": null,
    "tags": [{ "name": "flow", "value": "signup" }],
    "metadata": { "test_run": "docs-capture-1" },
    "broadcast_id": null,
    "brand_id": null
  }
}

See the events reference for field definitions. The payload does not include a simulator flag. Its event type and shape match a real hard bounce. Only the recipient address identifies the event as simulated. If your handler needs to special-case test traffic, match on the messagebird.dev recipient domain.

To verify that an already-suppressed recipient is not emailed, repeat the request with suppressed@messagebird.dev. Assert that you receive email.accepted, then email.rejected with rejection_reason: "recipient_suppressed". You should not receive email.processed or delivery events. This mirrors a real suppressed recipient. The message is accepted and short-circuited during processing before any delivery attempt.

What the sandbox does and doesn't do

  • No suppression-list writes. Simulated hard bounces and complaints do not add the recipient to your suppression list. This keeps the addresses reusable. Your webhook still fires (email.bounced, email.complained) and exercises your suppression logic. To test the already-suppressed rejection path, use the suppressed@ address.
  • No real delivery. Sandbox recipients are intercepted before the message reaches external delivery infrastructure. Nothing is transmitted, no inbox is involved, and your sending reputation is untouched.
  • Request validation still applies. A sandbox request uses the normal endpoints. Schema checks, size caps, and header rules reject invalid requests as usual. The sandbox skips everything past the handoff. Rendering and delivery behavior beyond that point are not exercised.
  • Opens and clicks are not simulated. A magic address simulates the transmission result only. Because no recipient opens the message, email.opened and email.clicked come only from real mail.
  • Stats include sandbox traffic. Sandbox messages count toward your workspace's aggregate stats and bounce and complaint rates. Heavy sandbox bouncing skews your dashboards without affecting your sending reputation.

Next steps

Continue with the documentation, guides and examples for this topic.