How do I test transactional emails safely before launch?
Capture mail locally with an SMTP catcher such as Mailpit or MailHog in development and CI, then send real test messages from a staging domain to inboxes you own. Check authentication results (SPF, DKIM, DMARC), rendering and links, and never test against real customer lists or fake addresses that bounce.
By AISend. Updated . Also as markdown.
Why it happens
Transactional email is hard to test because the real thing is a chain you do not control: your code builds the message, a provider sends it, the receiving server decides what to do, and a mail client renders it. Most teams test only the first link, then discover broken templates, missing authentication or spam-folder delivery on launch day, to real customers.
Testing carelessly has its own risks. Sending to made-up addresses produces hard bounces, which count against your sending reputation. Sending test mail to a copy of production data can email real customers. And a brand-new domain with no history can land in spam however good the template is.
- Logic and templates: does the right message go out for each event, with the right variables and links?
- Rendering: does the HTML work in Gmail, Outlook and mobile clients, and does the plain-text part read well?
- Authentication: do SPF, DKIM and DMARC pass for the domain you will actually send from?
- Delivery: does the message reach the inbox at the providers your users have?
- Failure handling: what does your code do on a bounce, a complaint, a 4xx or a rate limit?
How to fix it (a test plan for any provider)
- Catch all mail locally in development and CI. Run an SMTP catcher and point your app's SMTP settings at it so nothing leaves your machine. Mailpit is a single-binary SMTP server with a web UI and a REST API for integration tests; its SMTP server listens on port 1025 by default, with no encryption or authentication unless you configure them. MailHog does the same job with SMTP on port 1025, a web UI and JSON API on port 8025, and in-memory message storage by default.
// Run Mailpit (see its install docs for your platform), then point SMTP at port 1025. // Node, nodemailer, development only: const transport = nodemailer.createTransport({ host: "localhost", port: 1025, secure: false }); - Choose the transport by environment, and make production the default that fails closed. Read the transport from configuration, not from code branches. Development and test use the catcher; staging uses a real provider with a staging domain; production uses production credentials. Make it impossible for a test run to use production keys, and for a staging run to email addresses outside an allow-list.
// One place decides where mail goes export function makeMailer(env = process.env) { if (env.MAIL_MODE === "catcher") return smtpMailer({ host: env.SMTP_HOST ?? "localhost", port: 1025 }); if (env.MAIL_MODE === "staging") return allowListMailer(providerMailer(env.STAGING_KEY), env.STAGING_ALLOWED_RECIPIENTS.split(",")); if (env.MAIL_MODE === "production") return providerMailer(env.PROD_KEY); throw new Error("MAIL_MODE must be catcher, staging or production"); } - Assert on the captured messages in automated tests. Both catchers expose an HTTP API to list, fetch and delete messages. In an integration test, trigger the signup, fetch the message, and assert on recipient, subject, and that the confirmation link is present and well-formed. This catches broken templates and missing variables long before launch.
- Test rendering and spam signals. Mailpit includes an HTML and CSS compatibility check against common email clients, a link checker and a spam check using SpamAssassin or Rspamd. Use them, and also open real messages in Gmail, Outlook and a phone. Keep a plain-text alternative, make links visible and unambiguous, and make sure nothing is hidden with CSS, which Google lists among practices that can cause messages to be marked as spam.
- Use the provider's own test addresses if it has them. Some providers offer special recipient addresses that simulate outcomes without touching real inboxes. Resend, for example, documents delivered@resend.dev, bounced@resend.dev, complained@resend.dev and suppressed@resend.dev, supports labels after a plus sign, and says these test emails count against your sending quota; it also advises against sending to fake addresses and against setting up a fake SMTP server when testing against it. Check your own provider's documentation; not all have this.
- Authenticate a staging domain before sending anything real. Verify a subdomain such as staging.example.com (or a separate test domain) with the provider, publish the SPF and DKIM records, and add a DMARC record. Then confirm they pass: send to your own Gmail and Outlook inboxes and look at the original message headers for spf=pass, dkim=pass and dmarc=pass, or run the domain through a checker. A staging domain protects the reputation of the production domain while you break things.
- Send to seed inboxes you own. Create a handful of test mailboxes at the providers your users use (Gmail, Outlook, Yahoo, iCloud) and send each message type to them from the staging domain. Check where it lands (inbox, promotions, spam), how it renders, and that links resolve. Never test against a real customer list, a purchased list, or a copy of production data.
- Rehearse failures and the go-live ramp. Trigger a bounce and a complaint (using the provider's test address or your own seed inbox), and confirm your handler suppresses the address. Test the rate-limit path. Then go live with low volume to engaged recipients, raising it gradually: Google's guidance is to start with a low sending volume and increase slowly, monitoring delivery and spam rate as you go.
Which test tool for which job
| Tool | Use it to | Does not tell you |
|---|---|---|
| Mailpit or MailHog (local catcher) | See every message your code sends, with no mail leaving the machine; assert in CI. | Whether it will pass authentication or reach an inbox. |
| Provider test addresses (where offered) | Simulate delivered, bounced and complained events through the real API and webhooks. | How the message renders or whether your domain is trusted. |
| Staging domain plus seed inboxes | Check SPF, DKIM, DMARC, rendering and inbox placement. | How your whole audience's providers will treat the message. |
| HTML previewer and spam checker | Catch obvious rendering problems and spam-like content early. | Real inbox placement. |
Each row covers a different failure; none replaces a real send to inboxes you own.
When to use AISend
AISend is a transactional email API and has no sandbox or test mode: a send through AISend is a real send, including the 10 free test emails to your own address. For development and CI, use a local catcher such as Mailpit or MailHog as above, or point your AISend client at a mock of the REST API.
What AISend does offer for a first real test: an account created by a person, with or without a plan, can send up to 10 test emails from the shared address onboarding@send.aisend.app before any domain is verified, once the account email is verified. It can only be addressed to the account owner's own email; sending to anyone else needs your own verified domain, and AISend refuses it with a message to verify a domain first. That is a good way to see a real message arrive in your own inbox. It is metered on its own daily limit, whatever the plan.
For a real launch test: verify a staging subdomain, send to your own seed inboxes, then use list_domains, get_email_status and list_emails over MCP to check the result (status values: queued, sending, sent, delivered, failed, bounced, complained, quarantined). validate_email checks recipients, and sends are also screened for bad syntax, disposable domains and domains without mail servers. The in-browser tools on this site (email HTML previewer, SPF and DMARC checker, DKIM checker, spam score checker) need no account.
Choose something else if you need a provider-managed sandbox that simulates bounces and complaints without a real send; some providers offer test addresses and AISend does not. AISend is a young service with no deliverability benchmarks or inbox-placement statistics to quote, so measure with your own seed inboxes.
Copy-paste prompt for an AI assistant connected to AISend
Connect an assistant first (setup for ChatGPT, Claude, Cursor and Gemini CLI), then paste:
Assign to AISend: help me run a pre-launch email test. Use list_domains to show which of my sending domains are verified, and tell me which one I should use for staging. Draft a test message for my own address [my address] but do not send it. Once I approve the exact message, send it with send_email using idempotency key launch-test-1, then check get_email_status and list_emails and report the status exactly as returned. Show me what you did so I can approve each step, and never send to anyone but me.Frequently asked questions
Can I use Mailpit or MailHog with a production provider?
They replace the provider, they do not test it. In development and CI, point your SMTP settings at the catcher so nothing is sent. Use a real provider and a staging domain only when you want to test authentication, delivery and rendering.
Is it safe to send test emails to fake addresses?
No. Fake addresses hard-bounce, and bounces count against your sending reputation. Use a local catcher, a provider's documented test addresses, or inboxes you own.
Does AISend have a sandbox or test mode?
No sandbox: every send is a real send. For a first test, any account can email its own address from the shared onboarding@send.aisend.app sender; any other recipient needs a verified domain.
How do I check that SPF, DKIM and DMARC pass?
Send a message to your own Gmail or Outlook inbox from the real sending domain and open the original headers (Show original in Gmail). Look for spf=pass, dkim=pass and dmarc=pass, or run the domain through an SPF, DKIM and DMARC checker.
How many test messages should I send before going live?
Enough to cover every template and every outcome (delivered, bounced, complained) once, to several seed inboxes. Then launch at low volume to engaged recipients and raise it gradually while you watch bounces and spam complaints.
Sources
- Mailpit: email and SMTP testing tool (checked 2026-11-13)
- Mailpit documentation: SMTP server (checked 2026-11-13)
- MailHog on GitHub (README) (checked 2026-11-13)
- Resend documentation: Send test emails (checked 2026-11-13)
- Google: Email sender guidelines (Gmail Help) (checked 2026-11-13)