<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/mailbox-for-laravel-preview-and-test-rendered-email-6tqqnpkdk" -->

---
title: Mailbox for Laravel: Preview and Test Rendered Email
description: Mailbox for Laravel is a package that captures outgoing email and displays it in a local dashboard at /mailbox, letting developers inspect HTML, plain-text,...
canonical: https://daily.dev/posts/mailbox-for-laravel-preview-and-test-rendered-email-6tqqnpkdk
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Mailbox for Laravel: Preview and Test Rendered Email | daily.dev
og:description: Mailbox for Laravel is a package that captures outgoing email and displays it in a local dashboard at /mailbox, letting developers inspect HTML, plain-text,...
og:url: https://daily.dev/posts/mailbox-for-laravel-preview-and-test-rendered-email-6tqqnpkdk
og:image: https://api.daily.dev/og/posts/6TQqnpkDk.png
og:image:alt: Mailbox for Laravel: Preview and Test Rendered Email
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Mailbox for Laravel: Preview and Test Rendered Email

**[Laravel News](https://daily.dev/sources/ln)** · 3 min read · 1 upvotes · 0 comments

## Summary

Mailbox for Laravel is a package that captures outgoing email and displays it in a local dashboard at /mailbox, letting developers inspect HTML, plain-text, and raw views without a separate mail service. It requires PHP 8.3+ and supports Laravel 10 through 13. Beyond previewing, it provides a fluent test API (assertSentCount, assertHasSubject, assertHasTo, assertSeeInHtml, assertHasAttachment) for asserting on rendered messages, recipients, and attachments. Captured mail is stored by default in a SQLite database, with options for an existing database connection or file storage. A MAILBOX_DECORATE setting can forward captured mail to a real mailer for actual delivery. The dashboard is disabled by default in production, and automatic pruning of stored messages can be enabled via a retention schedule setting.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://laravel-news.com/mailbox-for-laravel>

## Questions this post answers

### How do I preview and test emails sent from a Laravel app without a real mail service?

Install the Mailbox for Laravel package as a dev dependency, run its install command, and set MAIL_MAILER=mailbox. Captured Mailables, mail notifications, and Mail::raw() messages appear in a local dashboard at /mailbox, where you can view HTML, plain-text, and raw versions, plus preview or download attachments. It requires PHP 8.3+ and works with Laravel 10 through 13.

_daily.dev surfaces packages like this for developers building out their Laravel testing workflow._

### How do I write assertions against a rendered Laravel email in a test?

Use the Mailbox facade's fluent assertion API: Mailbox::assertSentCount() checks how many messages were captured, and firstSent() returns an object supporting assertHasSubject(), assertHasTo(), assertSeeInHtml(), and assertHasAttachment(). The optional InteractsWithMailbox trait clears captured messages before each test and exposes $this->mailbox() as an alternative to the facade.

_Developers wiring up mail assertions can track packages like this one on daily.dev._

### Can I both capture emails in a local inbox and still deliver them for real during testing?

Yes, setting MAILBOX_DECORATE to a configured mailer name, such as smtp, forwards captured messages to that mailer while still showing them in the /mailbox dashboard. Mailbox is disabled by default in production, so the normal production mailer configuration should remain in place separately.

_daily.dev helps developers stay current on Laravel packages that shape mail delivery and testing setups._

## Similar posts on daily.dev

- [Statamic Mailables Viewer Previews Laravel Emails in the Control Panel](https://daily.dev/posts/statamic-mailables-viewer-previews-laravel-emails-in-the-control-panel-lzoincw84) · Laravel News · 1 upvotes · 0 comments
- [Laravel SMS Catcher: A Local Dashboard for SMS Notifications](https://daily.dev/posts/laravel-sms-catcher-a-local-dashboard-for-sms-notifications-ht7mjitnf) · Laravel News · 0 upvotes · 0 comments
- [Local Email Debugging with Mailpit](https://daily.dev/posts/local-email-debugging-with-mailpit-couqanrnq) · Jeff Geerling · 0 upvotes · 0 comments

---

Tags: [#testing](https://daily.dev/tags/testing), [#php](https://daily.dev/tags/php), [#laravel](https://daily.dev/tags/laravel)

[View this post on daily.dev](https://daily.dev/posts/mailbox-for-laravel-preview-and-test-rendered-email-6tqqnpkdk)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Mailbox for Laravel: Preview and Test Rendered Email","url":"https://daily.dev/posts/mailbox-for-laravel-preview-and-test-rendered-email-6tqqnpkdk","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/mailbox-for-laravel-preview-and-test-rendered-email-6tqqnpkdk"},"datePublished":"2026-09-30T13:41:44.814Z","dateModified":"2026-09-30T13:42:07.351Z","description":"Mailbox for Laravel is a package that captures outgoing email and displays it in a local dashboard at /mailbox, letting developers inspect HTML, plain-text,...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/51fb7aebf68443a91547897ebd0aae46?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/51fb7aebf68443a91547897ebd0aae46?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Laravel News","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Laravel News","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/ln","url":"https://daily.dev/sources/ln"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/mailbox-for-laravel-preview-and-test-rendered-email-6tqqnpkdk","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"testing,php,laravel","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Laravel News","item":"https://daily.dev/sources/ln"},{"@type":"ListItem","position":3,"name":"Mailbox for Laravel: Preview and Test Rendered Email"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/mailbox-for-laravel-preview-and-test-rendered-email-6tqqnpkdk#faq","mainEntity":[{"@type":"Question","name":"How do I preview and test emails sent from a Laravel app without a real mail service?","acceptedAnswer":{"@type":"Answer","text":"Install the Mailbox for Laravel package as a dev dependency, run its install command, and set MAIL_MAILER=mailbox. Captured Mailables, mail notifications, and Mail::raw() messages appear in a local dashboard at /mailbox, where you can view HTML, plain-text, and raw versions, plus preview or download attachments. It requires PHP 8.3+ and works with Laravel 10 through 13. daily.dev surfaces packages like this for developers building out their Laravel testing workflow."}},{"@type":"Question","name":"How do I write assertions against a rendered Laravel email in a test?","acceptedAnswer":{"@type":"Answer","text":"Use the Mailbox facade's fluent assertion API: Mailbox::assertSentCount() checks how many messages were captured, and firstSent() returns an object supporting assertHasSubject(), assertHasTo(), assertSeeInHtml(), and assertHasAttachment(). The optional InteractsWithMailbox trait clears captured messages before each test and exposes $this->mailbox() as an alternative to the facade. Developers wiring up mail assertions can track packages like this one on daily.dev."}},{"@type":"Question","name":"Can I both capture emails in a local inbox and still deliver them for real during testing?","acceptedAnswer":{"@type":"Answer","text":"Yes, setting MAILBOX_DECORATE to a configured mailer name, such as smtp, forwards captured messages to that mailer while still showing them in the /mailbox dashboard. Mailbox is disabled by default in production, so the normal production mailer configuration should remain in place separately. daily.dev helps developers stay current on Laravel packages that shape mail delivery and testing setups."}}]}
```

