Catch Laravel mail locally with Mailpit

Testing password resets and order mails should never reach a real customer. Mailpit is a local mail server with a web inbox: everything your apps send lands there.

Install and start Mailpit

  1. Open Quick Add and install Mailpit.
  2. Start it from its card on the Services page, or with Start All.
  3. Open the inbox from the same card or from the tray.

Point Laravel at it

New Laravel projects from QuickApp are set up already. For an existing one, in .env:

MAIL_MAILER=smtp
MAIL_HOST=127.0.0.1
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null

Any user name and password are accepted.

Plain PHP and WordPress

PHP's mail() goes to Mailpit too while it runs, so WordPress and other PHP apps need no plugin. Switch that off in Settings › Mail.

Questions

Can mail still reach the internet?

No. Mailpit keeps every message locally; nothing is delivered.

Which port is the inbox on?

SMTP on 1025 and the web inbox on 8025, both on your computer only.

Related guides