spatie/laravel-mail-preview
A Laravel mail transport that previews sent mail locally. Swap your mailer's transport to 'preview' and a small overlay appears whenever a mail is sent, linking to the rendered message. Add the middleware to the web group to enable it. Handy for testing emails in local environments.
.html and .eml on disk, it compresses the design-review loop for transactional emails (receipts, password resets, onboarding, notifications). PMs can decide to invest in richer email templates knowing the review cycle is same-hour, not same-sprint.SentMails facade enables content assertions (assertLastContains, assertSent, assertCount, assertNothingSent) that Laravel's Mail::fake cannot do because fakes do not render mailables. That turns "the welcome email looks right" from a manual QA checklist item into an automated CI check — a direct input to release-gate policy.enabled => env('APP_DEBUG', false), so the decision "preview in local/staging only, never production" is enforced by configuration, not convention. This is the kind of guardrail that reduces the blast radius of an accidental config copy..eml in a real client for accurate rendering), regression tests on email copy (legal disclaimers, pricing, unsubscribe links), and post-refactor verification that recipients/CC/BCC wiring did not change.Adopt when:
themsaid).Look elsewhere or add caveats when:
preview transport writes to disk. It must be scoped to non-production APP_DEBUG environments; any deployment that runs with debug on in production becomes a data-retention and PII-hygiene concern. Pair adoption with an explicit config audit.Mail::fake: Existing suites would need to migrate assertions to the SentMails facade, which is an incremental cost and a new testing idiom to document.preview-style transport or a filesystem-based log driver) rather than a load-bearing architectural pillar.Swift_Mime_SimpleMessage types, and behavior depends on Laravel's mail manager internals — upgrades across major Laravel versions have historically required package releases. Plan for minor version churn.For executives (30 seconds): This is a small, free, MIT-licensed add-on for our Laravel application that makes every email we send during development instantly visible and testable. It costs nothing to license, takes under an hour to install, and shortens the loop between "we wrote an email" and "we approved how it looks" from days of manual QA to minutes. It also lets us put email content under automated tests, which reduces the risk of a broken receipt, a wrong price, or a missing legal disclaimer reaching customers.
For engineering leads:
preview), one middleware registration, one route macro — reversible in minutes..html and .eml) land in storage/email-previews with configurable retention and filename format; an overlay link appears on responses with a configurable popup timeout.MailStoredEvent with paths to both versions, so it composes with existing observability or tooling.SentMails facade that closes a real gap in Laravel testing: Mail::fake doesn't render mailables, so you can't assert on content. This one can — subject, body substrings, recipients, CC/BCC, counts.APP_DEBUG only, so it self-disables outside local/staging.For design and marketing stakeholders: You get to see the actual email — and open the .eml in Outlook, Gmail, or Apple Mail for a realistic rendering — before it goes to a customer. No more "can you forward me a screenshot."
Recommended decision: Adopt for local and staging as a developer-experience and email-quality tool with a probationary status: it is a small, actively maintained but thinly-depended-upon package, so assign an owner, pin the version, and keep a documented fallback in case maintenance lapses. Gate on a one-line config audit confirming it cannot activate in production.
How can I help you explore Laravel packages today?