Test Laravel emails locally on your Mac

Catch every email your Laravel app sends in development with a local SMTP server on your Mac. Set up .env in a minute, no Docker or Mailtrap account needed.

Laravel makes sending email easy — which also makes it easy to send a password reset to a real customer from your laptop. Pointing your local app at Mailbox fixes that: every mailable, notification and Mail::raw() call lands in Mailbox on your Mac, where you can inspect the HTML, headers and attachments. Nothing is delivered.

1. Start a server in Mailbox

Open Mailbox. On first launch it creates a server on port 2525 — make sure it’s started. If you add another server instead, Mailbox picks a free port for it; use that port in the steps below.

2. Point Laravel at it

Recent Laravel versions already ship a .env with MAIL_HOST=127.0.0.1 and MAIL_PORT=2525 — exactly where Mailbox listens. Usually the only line to change is MAIL_MAILER, from log to smtp. The complete block looks like this:

MAIL_MAILER=smtp
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"

Mailbox doesn’t use SMTP authentication or TLS, so leave the username, password and scheme as null — Laravel then uses plain SMTP on any port other than 465. On Laravel 10 and older the key is called MAIL_ENCRYPTION instead of MAIL_SCHEME; set it to null as well.

If you have cached your config, clear it so Laravel picks up the new values:

php artisan config:clear

3. Send a test email

Laravel has no built-in test command, but one line of Tinker does the job:

php artisan tinker --execute='Mail::raw("It works!", fn ($m) => $m->to("test@example.com")->subject("Hello from Laravel"));'

The email shows up in Mailbox right away. Your real mailables and notifications go through the same path — trigger a password reset or a sign-up and they appear in the same inbox.

Using Laravel Sail, DDEV or Docker

Inside a container, 127.0.0.1 is the container itself, not your Mac. Use host.docker.internal instead:

MAIL_HOST=host.docker.internal
MAIL_PORT=2525

Sail installs a Mailpit container by default and points MAIL_HOST at it. Once you switch to Mailbox, remove the mailpit service from compose.yaml and from the depends_on list of laravel.test, or install Sail without it: php artisan sail:install --with=mysql,redis.

DDEV rewrites the MAIL_* values in .env on every ddev start. Run ddev config --disable-settings-management first (this also stops DDEV from managing the DB_* values), then set the host and port above. DDEV expects host services to listen on all interfaces, so turn on Allow Network Access in Mailbox (Settings → General) and restart the server.

If the container still can’t connect, turn on Allow Network Access in Mailbox (Settings → General) and restart the server, so it accepts connections from outside the loopback interface.

Troubleshooting

  • “Connection could not be established” — the server isn’t running, or MAIL_PORT doesn’t match the port in Mailbox.
  • Nothing arrives, no error — queued mailables (ShouldQueue) are only sent when a worker runs: php artisan queue:work. Or set QUEUE_CONNECTION=sync locally.
  • Old values still used — run php artisan config:clear again after editing .env.

What to check next

Once emails arrive, use Mailbox’s HTML compatibility check to see which CSS your templates rely on that Outlook or Gmail won’t render, and the mobile preview to check the layout on a phone-sized viewport. Running several apps? With Mailbox Pro, give each one its own server and port so their emails never mix.

More guides