Skip to content

Migrating from Mailtrap to Mailexam

Mailtrap and Mailexam solve the same problem: catch outbound mail in development, QA, and CI/CD so messages never reach real recipients. Migration means swapping SMTP settings and, if needed, API calls in tests. Your sending code (Mail, Nodemailer, Action Mailer, etc.) stays the same.

At a glance

Mailtrap Sandbox Mailexam
Purpose Test SMTP inbox Test SMTP inbox
Host sandbox.smtp.mailtrap.io {login}.mailexam.io
Ports 25, 2525, 465, 587 25, 2525, 465, 587
Username Unique per sandbox Unique per project
Password Paired with sandbox username Paired with project username
SMTP auth Required Required (PLAIN)
API for CI/CD Yes Yes

Recommended port

For both services, 587 + TLS (STARTTLS) works best. If your provider blocks port 25, use 2525.

What you need

  1. A Mailexam account — sign up takes a couple of minutes.
  2. A project with SMTP credentials — created on registration; login, password, and host are in the welcome email and the dashboard.
  3. Access to your app config: .env, CI/CD variables, pipeline secrets.

Step 1. Get Mailexam credentials

After registration, the welcome email (or dashboard) provides three values:

Parameter Example Note
Login abc123 Project SMTP username
Password •••••••• Unique pair with the login
Host abc123.mailexam.io Matches the login

See Integration examples for shared SMTP parameters.

Step 2. Replace SMTP settings

Find Mailtrap variables in your project and plug in Mailexam values. Variable names may differ — what matters is host, port, username, password.

Before (Mailtrap)

MAIL_HOST=sandbox.smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=your_mailtrap_username
MAIL_PASSWORD=your_mailtrap_password
MAIL_ENCRYPTION=tls

After (Mailexam)

MAIL_HOST=YOUR_LOGIN.mailexam.io
MAIL_PORT=587
MAIL_USERNAME=YOUR_LOGIN
MAIL_PASSWORD=YOUR_PASSWORD
MAIL_ENCRYPTION=tls

From address

MAIL_FROM_ADDRESS / MAIL_FROM can stay any test address — the message lands in Mailexam, not with a real recipient.

Parameter mapping

Parameter Mailtrap Mailexam
Host sandbox.smtp.mailtrap.io {login}.mailexam.io
Port 2525 (or 587) 587 (recommended)
Username from sandbox Integration tab from welcome email
Password from sandbox Integration tab from welcome email
Encryption TLS / STARTTLS TLS / STARTTLS

Stack-specific guides

Ready-made snippets are in the examples catalog:

Stack Page
Laravel Laravel
Django Django
Node.js / Nodemailer Node.js
Ruby on Rails Ruby on Rails
Spring Boot Spring Boot

Step 3. Update CI/CD

If your pipeline stores Mailtrap secrets, replace them with Mailexam:

Before (Mailtrap) After (Mailexam)
MAILTRAP_USER / MAILTRAP_USERNAME MAILEXAM_LOGIN
MAILTRAP_PASS / MAILTRAP_PASSWORD MAILEXAM_PASSWORD
MAIL_HOST=sandbox.smtp.mailtrap.io MAIL_HOST=${MAILEXAM_LOGIN}.mailexam.io

GitLab CI example:

variables:
  MAIL_HOST: "${MAILEXAM_LOGIN}.mailexam.io"
  MAIL_PORT: "587"
  MAIL_USERNAME: "${MAILEXAM_LOGIN}"
  MAIL_PASSWORD: "${MAILEXAM_PASSWORD}"
  MAIL_ENCRYPTION: "tls"

Add MAILEXAM_LOGIN and MAILEXAM_PASSWORD to your project's CI/CD Variables.

Step 4. Move API-based tests (if you used them)

Mailtrap Sandbox API lets you fetch messages and assert on content programmatically. Mailexam supports the same workflows via REST API:

Task Mailtrap Mailexam
List messages Sandbox API GET /api/v1/email
Single message Sandbox API GET /api/v1/email/{uuid}
Attachment Sandbox API GET /api/v1/email/{uuid}/attachment
Manage sandboxes Sandboxes API GET /api/v1/project

Typical CI flow:

  1. Send mail via SMTP (with new credentials).
  2. Wait for delivery (1–5 seconds).
  3. Call GET /email filtered by subject or recipient.
  4. Assert on body, headers, or attachments in the API response.

Authorize API requests with a token from the Mailexam dashboard (see API docs).

Step 5. Verify delivery

  1. Clear your app config cache if applicable: php artisan config:clear, container restart, etc.
  2. Send a test message from the app or console.
  3. Open the dashboard → your project → inbox. The message should appear within seconds.

Troubleshooting

Message does not show up in the inbox

  • Confirm MAIL_HOST is {login}.mailexam.io, not smtp.mailexam.io or sandbox.smtp.mailtrap.io.
  • MAIL_USERNAME must match the host prefix before .mailexam.io.
  • Ensure SMTP auth is enabled and the password was copied without extra spaces.

Connection error / timeout

  • Try port 587 or 2525 instead of 25.
  • Check whether a firewall blocks outbound SMTP (common on corporate networks and CI runners).

CI still uses old secrets

  • Renaming variables is not enough — values must come from Mailexam, not Mailtrap.
  • Re-run the pipeline after updating secrets.

Need multiple isolated inboxes

  • In Mailtrap — separate sandboxes. In Mailexam — separate projects or inboxes within a project (see /inbox in the API).

Good to know

  • Message history from Mailtrap is not migrated — Mailexam starts a fresh sandbox. Old messages remain in Mailtrap while that account is active.
  • Application code does not need changes — only SMTP config and, optionally, API-based tests.
  • Mailexam does not use cookies for on-site tracking — see Why we don't use cookies.

FAQ

Can I run both services in parallel? Yes. Create a separate Mailexam project for staging/CI and keep Mailtrap during transition — switch by changing .env.

Do I need DNS or SPF changes? No. Both services accept mail over SMTP into a test inbox; sender domain settings do not affect sandbox delivery.

Are there limits? Depends on your Mailexam plan. Development and CI usually fit a free or starter tier — see current terms at mailexam.io.


Need help migrating a specific stack? Contact support@mailexam.io.