PHPackages                             hexters/maillens - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. hexters/maillens

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

hexters/maillens
================

Catch outgoing mail during local development and read it in the browser at /mail. Set MAIL\_MAILER=lens and every email your Laravel app sends is stored instead of delivered.

1.2.0(today)08↑2900%MITPHPPHP ^8.1CI passing

Since Jul 1Pushed todayCompare

[ Source](https://github.com/hexters/maillens)[ Packagist](https://packagist.org/packages/hexters/maillens)[ Docs](https://github.com/hexters/maillens)[ Fund](https://www.buymeacoffee.com/hexters)[ GitHub Sponsors](https://github.com/hexters)[ RSS](/packages/hexters-maillens/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (7)Versions (6)Used By (0)

 [![MailLens](https://raw.githubusercontent.com/hexters/maillens/main/src/Resources/logo.png)](https://raw.githubusercontent.com/hexters/maillens/main/src/Resources/logo.png)

MailLens
========

[](#maillens)

 [![Latest Stable Version](https://camo.githubusercontent.com/7d873faa9aa60c899895e4c040d24e47e3f9c3b4bfa63ee0798341ce3cceace4/68747470733a2f2f706f7365722e707567782e6f72672f686578746572732f6d61696c6c656e732f762f737461626c65)](https://packagist.org/packages/hexters/maillens) [![Total Downloads](https://camo.githubusercontent.com/e2c658af174d803a29232c360187bd3643359c2cb12c21d06a91b9f44867721d/68747470733a2f2f706f7365722e707567782e6f72672f686578746572732f6d61696c6c656e732f646f776e6c6f616473)](https://packagist.org/packages/hexters/maillens) [![Tests](https://github.com/hexters/maillens/actions/workflows/tests.yml/badge.svg)](https://github.com/hexters/maillens/actions/workflows/tests.yml) [![License](https://camo.githubusercontent.com/53a180756e912ddd1f1e59022f840239d6d7e18d65a1ed324eeb01f04f1fb50d/68747470733a2f2f706f7365722e707567782e6f72672f686578746572732f6d61696c6c656e732f6c6963656e7365)](https://packagist.org/packages/hexters/maillens)

MailLens catches the email your app sends while you are developing, so you can read it in the browser instead of wiring up a real inbox. Set one env variable and every message your Laravel app tries to send gets saved and shown at `/mail`. There is nothing to install outside Composer, no Docker, and no SMTP catcher running in the background.

If you have used Mailtrap or Mailpit before, it is the same idea, except it lives inside your own app.

Requirements
------------

[](#requirements)

- PHP 8.1 or newer
- Laravel 10, 11, 12, or 13

Install
-------

[](#install)

```
composer require hexters/maillens --dev
```

The service provider registers itself. Set the mailer in your `.env`:

```
MAIL_MAILER=lens
```

Then run the migration to create the table MailLens stores mail in:

```
php artisan migrate
```

Set `MAIL_MAILER=lens` before you migrate. The migration only loads while that mailer is active, so running `migrate` first would skip it and the table would not be created.

Now send mail the way you normally would and open `/mail` to read it. You do not need to touch `config/mail.php`; MailLens adds the `lens` mailer for you.

How it works
------------

[](#how-it-works)

Setting `MAIL_MAILER=lens` sends your mail through a transport that stores the message instead of delivering it. It keeps the subject, the sender and recipients, the HTML and text bodies, any attachments, and the raw source. The `/mail` page puts the message list on one side and the selected message on the other, with tabs for HTML, plain text, and source, plus links to download any attachments.

Queued mail
-----------

[](#queued-mail)

MailLens only changes where your mail ends up, not how your queue works. If a mailable is queued (`ShouldQueue`, `Mail::queue()`, or a queued notification), it shows up in `/mail` after the queue runs the job, the same as it would before a real send:

- `QUEUE_CONNECTION=database`: run a worker with `php artisan queue:work`
- `QUEUE_CONNECTION=redis`: run your worker, or Horizon if that is your setup
- `QUEUE_CONNECTION=sync`: nothing to run, the mail is captured right away

So if a queued email never shows up, check that a worker is running before you blame MailLens.

Turning it off
--------------

[](#turning-it-off)

There is no separate switch. `MAIL_MAILER` is the switch. When it is set to anything other than `lens`, MailLens stays quiet: it does not register the `/mail` route, it does not load its migration, and nothing routes through it. Keep `MAIL_MAILER=lens` out of your production `.env` and your mail will send for real there.

Password protection
-------------------

[](#password-protection)

By default `/mail` is open, which is fine on your own machine. If the inbox lives somewhere other people can reach, such as a shared staging server, set a password and MailLens asks for it before showing anything:

```
MAILLENS_PASSWORD=some-secret
```

Leave it unset and there is no lock screen.

Configuration
-------------

[](#configuration)

Most people never need this, but you can publish the config file to change the defaults:

```
php artisan vendor:publish --tag=maillens-config
```

```
MAILLENS_PASSWORD=            # protect /mail with a password (unset = open)
MAILLENS_ROUTE_PREFIX=mail    # the inbox lives here
MAILLENS_LIMIT=200            # how many messages to keep (null keeps all of them)
```

Captured mail is saved on your app's default database connection.

Contributing
------------

[](#contributing)

Bug reports and pull requests are welcome. Have a look at [CONTRIBUTING.md](CONTRIBUTING.md) first.

License
-------

[](#license)

MIT. See [LICENSE](LICENSE).

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance100

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

5

Last Release

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7d97e7edbbe58dd16d6f776aec2dacf66c5aeb730b9a4aa3de34ca0c1ebbfb9e?d=identicon)[hexters](/maintainers/hexters)

---

Top Contributors

[![hexters](https://avatars.githubusercontent.com/u/7827420?v=4)](https://github.com/hexters "hexters (13 commits)")

---

Tags

phplaravelmailemailmailersmtpmailtrapdev-toolsmailcatcheremail previewemail testinglocal-developmentmailpit

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hexters-maillens/health.svg)

```
[![Health](https://phpackages.com/badges/hexters-maillens/health.svg)](https://phpackages.com/packages/hexters-maillens)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M345](/packages/psalm-plugin-laravel)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M129](/packages/laravel-pulse)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.5k55.4M8.1k](/packages/larastan-larastan)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M125](/packages/roots-acorn)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M142](/packages/laravel-mcp)[api-platform/laravel

API Platform support for Laravel

59156.3k11](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
