Skip to content
MailSlurp logo

Email Address Generator: Create Real Inboxes for Testing

Learn how to create real email accounts on demand for software testing, automation, custom domains, SMTP, IMAP, and development workflows.

An email address generator is useful when you need a fresh recipient for a signup, password reset or campaign test. The important distinction is whether it creates a working inbox or just a plausible-looking string. A made-up address can fill a form, but it cannot show you the email your app sent.

MailSlurp creates real inboxes that you can open in the dashboard or access through an API. For a quick manual check, start with the private email generator. For repeated tests, use a separate generated inbox for each run.

Choose the kind of address your test needs

Task Address to use What to check
Test a form's required fields An explicitly fictional fixture Validation errors and accepted syntax
Receive a verification or reset email A real generated inbox Arrival, recipient, code or link, and the completed application action
Test several accounts at once One inbox per account or test Messages stay isolated and assertions use the correct inbox
Test a branded sender or recipient An inbox on a verified custom domain Domain setup and the exact address used by the application

Use fixture addresses only when no mail should be delivered. For a real send, copy the address returned by the inbox service instead of inventing a recipient at a domain you do not control.

Create an email address in the dashboard

  1. Create a MailSlurp account and open the inbox area.
  2. Create a new inbox with a generated address.
  3. Copy the complete address into your application's signup form or email recipient field.
  4. Trigger the actual email flow.
  5. Open the receiving inbox and inspect the message.

Create Random Email

A successful signup-form submission is only the first step. Wait for the message, use its verification link or code, and confirm the application reaches the expected state. The email testing guide covers that full workflow.

Generate addresses for automated tests

The API returns both an inbox ID and an email address. Use the address as the recipient your application sends to; use the ID to wait for and inspect messages through MailSlurp. Swapping those values is an easy way to make a valid inbox look broken.

This server-side JavaScript example creates an inbox that expires after ten minutes. Set MAILSLURP_API_KEY in your environment and install mailslurp-client before running it as an .mjs file:

import { MailSlurp } from "mailslurp-client";

const apiKey = process.env.MAILSLURP_API_KEY;
if (!apiKey) throw new Error("Set MAILSLURP_API_KEY");

const mailslurp = new MailSlurp({ apiKey });
const inbox = await mailslurp.createInboxWithOptions({
  name: "Signup test",
  expiresIn: 10 * 60 * 1000,
});

console.log({ inboxId: inbox.id, emailAddress: inbox.emailAddress });

Keep the API key on the server or in your test runner. After the application sends its email, use waitForLatestEmail(inbox.id, 30_000, true) on this fresh inbox. Assert the received subject and body, then complete the intended user action. For a full example with cleanup, follow the JavaScript email testing guide.

Give parallel tests different inboxes. A shared address can make one test read another test's message, especially when several password resets have the same subject. Delete each test's inbox after its assertions and use expiration as a fallback for an interrupted run. Expiry closes further sending and receiving; it is separate from deleting retained messages.

Put your application action and message assertions inside a try block, then remove that inbox in finally:

try {
  // Trigger your application's email and assert its result here.
} finally {
  await mailslurp.inboxController.deleteInbox({ inboxId: inbox.id });
}

This is the cleanup structure around your test, not a complete email assertion by itself. Keep the inbox available until the signup, reset or OTP action has finished. Delete the application's test user separately; deleting its recipient mailbox does not remove the application's account.

Use your own domain when the workflow needs it

For a company-branded test address, verify a domain you control and create the inbox using that domain's settings. The custom-domain guide explains the required DNS records and verification.

A dedicated test subdomain helps keep test routing separate from staff mail. Follow the domain setup instructions carefully before changing MX records: those records affect where incoming mail for that domain is delivered.

Plus-address aliases are another option when a provider supports them, but they are not automatically separate inboxes. If your test needs isolated message storage and independent cleanup, create distinct inboxes rather than assuming every +tag creates a new account.

Read and send from the generated inbox

You can read the received message and attachments in the dashboard or through the API. Check the actual recipient, subject, plain text, HTML, links and headers. For a password-reset test, receiving the email is not enough: the reset URL should work for the intended account and finish the reset.

View Emails

Generated inboxes also support sending through the dashboard or send email API. Use the inbox's returned address and the sending permissions available for your account.

compose

If you need an email client or an application that expects SMTP and IMAP, follow the SMTP and IMAP setup guide for the correct inbox type and credentials.

When a generated address does not receive email

Check the complete recipient against the address returned by MailSlurp. Then confirm the inbox has not expired, the application actually attempted the send, and the sending provider accepted that recipient. A mistyped domain or a trial restriction can stop the message before it reaches the test inbox.

For a custom domain, verify its DNS and inbox configuration. For an automated test, check that the wait uses the right inbox ID and enough time for the application's queue. The inbox delivery checklist walks through these checks.

Common questions

Does generating an address create a working inbox?

MailSlurp creates a real inbox. A random string generator only creates text, so choose the tool according to whether the test must receive mail.

Can I generate a Gmail or Outlook account this way?

MailSlurp generates MailSlurp inboxes and addresses on domains you have configured. To test a message's appearance in Gmail, Outlook or Apple Mail, use device previews after sending the message through your normal provider.

Should generated inboxes be temporary?

Use expiration for short test runs and choose a longer-lived inbox when a workflow must receive later replies. Keep the lifetime long enough for the action you are testing, then delete short-lived inboxes explicitly. Retain a persistent inbox only when the scenario needs the same address in a later session.

What should I test after the email arrives?

Check the message's content and complete the customer action: verify the signup, apply the password reset or use the OTP. For a campaign, also check device rendering and inbox placement before the send.