Generate Test Email Addresses Instantly with Tag-Based Addresses
What Are Tag-Based Addresses?
MailBrew's tag-based addresses let you receive emails at {anything}@{company}.mailbrew.dev:
user-001@acme.mailbrew.dev
signup-test-abc@acme.mailbrew.dev
password-reset-xyz@acme.mailbrew.dev
These addresses don't need a creation API call first. The address is registered automatically when its first email arrives. Before that first email, mailbox retrieval and wait API calls return 404, so retrieve it after the message arrives.
Traditional vs Tag-Based
Traditional: Create via API
// 1. Call API to create address (network latency)
const addr = await mb.createAddress({ ttl: 300 });
// 2. Use the created address
await page.fill('[name="email"]', addr.address);
Tag-Based: Use Immediately
// Generate UUID and use directly (no creation API call)
const addr = `test-${crypto.randomUUID()}@acme.mailbrew.dev`;
await page.fill('[name="email"]', addr);
Benefits
- No creation API latency — Use the address string in your test immediately
- No creation API rate-limit usage — Retrieval and wait API calls remain rate-limited as usual
- Perfect for parallel tests — UUIDs guarantee no collisions
- Simple — No SDK call needed just to prepare an address
Usage Patterns
Pattern 1: Per-Test Addresses
test('signup flow', async ({ page }) => {
const email = `signup-${Date.now()}@acme.mailbrew.dev`;
// ...
});
Pattern 2: Per-Service Addresses
In microservice environments, use service-specific prefixes:
auth-service-{id}@acme.mailbrew.dev
billing-{id}@acme.mailbrew.dev
notification-{id}@acme.mailbrew.dev
Pattern 3: Multi-Language Testing
const locales = ['ja', 'en', 'zh'];
for (const locale of locales) {
const email = `lang-test-${locale}@acme.mailbrew.dev`;
await testSignupFlow(email, locale);
}
Retrieving Emails
Emails sent to tag-based addresses can be retrieved via the standard API:
const email = await mb.waitForEmail(
`test-abc@acme.mailbrew.dev`,
{ timeout: 30000 }
);
Combined with Custom Domains
On Pro plans and above, combine custom domains with tag-based addresses:
test-{id}@mail.your-company.com
Test with your own domain's email addresses, even for applications with domain-based validation.
Summary
Tag-based addresses make test email address generation zero-cost. Especially ideal for parallel E2E test execution and CI environments.