PHPackages                             sefirosweb/laravel-mailing - 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. sefirosweb/laravel-mailing

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

sefirosweb/laravel-mailing
==========================

Package to help the mailing groups in front end

v13.0.2(1mo ago)0120MITTypeScriptPHP ^8.3CI passing

Since May 22Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/sefirosweb/laravel-mailing)[ Packagist](https://packagist.org/packages/sefirosweb/laravel-mailing)[ RSS](/packages/sefirosweb-laravel-mailing/feed)WikiDiscussions 13.x Synced today

READMEChangelogDependencies (3)Versions (15)Used By (0)

Laravel Mailing
===============

[](#laravel-mailing)

Manage mailing lists in Laravel: each list is a named collection of internal users + arbitrary external email addresses (grouped into "mailing groups"). Ships with a React admin UI and a helper to resolve a list's full recipient set from code.

Typical flow: create a list, add local users to it, optionally add an external mailing group, and from your code call `MailingList::get('list_code')` to get the final list of email addresses to send to.

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

[](#requirements)

- PHP `^8.3`
- Laravel `^13.0`
- A `users` table in your host app. The `MailingList` model attaches users via `belongsToMany` to a configurable User class (defaults to `App\Models\User`, see [Configuration](#configuration)).

Installation
------------

[](#installation)

```
composer require sefirosweb/laravel-mailing:^13.0
```

The service provider auto-registers via Laravel's package discovery.

Run migrations:

```
php artisan migrate
```

Creates four tables: `mailing_lists`, `mailing_groups`, `mailing_list_user` (pivot for users), and `mailing_group_mailing_list` (pivot for groups inside a list).

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

[](#configuration)

Publish the config:

```
php artisan vendor:publish --provider="Sefirosweb\LaravelMailing\LaravelMailingServiceProvider" --tag=config --force
```

Default `config/laravel-mailing.php`:

```
return [
    'prefix'     => 'mailgroups',
    'middleware' => 'web',
    'stage_to'   => env('MAIL_LIST_STAGE_TO', 'Create "MAIL_LIST_STAGE_TO" in .env with default mail'),
    'User'       => \App\Models\User::class,
];
```

- `prefix`: URL prefix for the bundled admin UI (`/mailgroups/...`).
- `middleware`: middleware stack for those routes.
- `stage_to`: a single email address used in non-production environments — see [Environment-aware recipients](#environment-aware-recipients) below.
- `User`: the Eloquent model used as the user side of the `mailing_list_user` pivot. Override to point the package at your custom User model without forking it.

> ⚠️ **Security**: the admin UI manages mailing recipients. Always protect it with auth + an ACL check. If you use [`sefirosweb/laravel-access-list`](https://github.com/sefirosweb/laravel-access-list):
>
> ```
> 'middleware' => ['web', 'auth', 'checkAcl:mailing_edit'],
> ```

Publish the React admin UI assets:

```
php artisan vendor:publish --provider="Sefirosweb\LaravelMailing\LaravelMailingServiceProvider" --tag=mailing-assets --force
```

Usage
-----

[](#usage)

### 1. Create lists and groups from the UI

[](#1-create-lists-and-groups-from-the-ui)

Browse to `/mailgroups` (or the configured prefix). The bundled UI is a self-contained React 19 + Vite SPA with two top-level tabs:

- **Listas** — table of mailing lists with name / code / description and a counter for users + groups attached. Each row opens two relations drawers (Users, Groups) for live attach/detach with optimistic updates. Soft-delete UI with an Activos / Todos / Eliminados segmented filter and a Restore action.
- **Grupos** — table of mailing groups (reusable external recipients with `name` + `to`). Same soft-delete UX.

Both tables ship with debounced search (200 ms), client-side pagination and per-row spinners on in-flight toggles. Hash routing keeps tabs deep-linkable (`/mailgroups/#lists`, `/mailgroups/#groups`). i18n with browser language detection (ES / EN) plus a manual switcher in the top nav.

[![Listas](docs/screenshots/lists.png)](docs/screenshots/lists.png)[![Grupos](docs/screenshots/groups.png)](docs/screenshots/groups.png)[![Drawer de usuarios de una lista](docs/screenshots/list-users-drawer.png)](docs/screenshots/list-users-drawer.png)

Definitions:

- **Mailing list**: a named collection addressed by a **code** (machine identifier used from code). Attach internal users by searching their name.
- **Mailing group**: a reusable external recipient with `name` + `to` (email). Add groups to a list when you need to email someone who is not a user in your system.

### 2. Resolve recipients from code

[](#2-resolve-recipients-from-code)

Given a list with `code = 'weekly_report'`:

```
use Sefirosweb\LaravelMailing\Http\Helpers\MailingList;

$recipients = MailingList::get('weekly_report');
// ['alice@acme.test', 'bob@acme.test', 'external@vendor.test']

Mail::to($recipients)->send(new WeeklyReportMail($data));
```

Returns `[]` if no list with that code exists.

### 3. Environment-aware recipients

[](#3-environment-aware-recipients)

`MailingList::get()` checks `config('app.env')`. **Only in `production`** does it resolve the real recipients. In any other environment it returns `[config('laravel-mailing.stage_to')]` so test/staging runs never email real users by accident.

Set the staging recipient:

```
MAIL_LIST_STAGE_TO=dev@acme.test
```

Testing
-------

[](#testing)

```
composer install
./vendor/bin/phpunit
```

The Orchestra Testbench suite covers controller CRUD, list↔user and list↔group pivot management, and validation edge cases.

> Note: `MailingGroupRequest` validates `to` with the `email:dns` rule, which performs a live DNS lookup. The test suite uses `gmail.com` so tests don't depend on custom domain resolution.

When working from the [laravel-test](https://github.com/sefirosweb/laravel-test) harness with Sail:

```
docker exec -w /var/www/html/packages/laravel-mailing laravel-test-laravel.test-1 ./vendor/bin/phpunit
```

Versioning
----------

[](#versioning)

Major versions are aligned with Laravel majors (`12.x`, `11.x`, `9.x` …). See the root [CLAUDE.md](https://github.com/sefirosweb/laravel-test/blob/12.0/CLAUDE.md) of the test harness for the full policy.

License
-------

[](#license)

MIT.

###  Health Score

48

—

FairBetter than 93% of packages

Maintenance89

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity71

Established project with proven stability

 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 ~111 days

Recently: every ~4 days

Total

14

Last Release

55d ago

Major Versions

1.2.0 → 9.x-dev2023-04-09

9.x-dev → v12.0.02026-04-23

v12.0.3 → v13.0.02026-05-09

PHP version history (2 changes)v12.0.0PHP ^8.2

v13.0.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/e00c36bae7e59a7375c9bc0e0280ef4004afa4ca968ea6cd62f7d880df2dbd66?d=identicon)[sefirosweb](/maintainers/sefirosweb)

---

Top Contributors

[![sefirosweb](https://avatars.githubusercontent.com/u/20754836?v=4)](https://github.com/sefirosweb "sefirosweb (40 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sefirosweb-laravel-mailing/health.svg)

```
[![Health](https://phpackages.com/badges/sefirosweb-laravel-mailing/health.svg)](https://phpackages.com/packages/sefirosweb-laravel-mailing)
```

###  Alternatives

[spatie/laravel-failed-job-monitor

Get notified when a queued job fails

1.1k2.8M4](/packages/spatie-laravel-failed-job-monitor)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k7](/packages/statamic-rad-pack-runway)[api-platform/laravel

API Platform support for Laravel

58171.4k14](/packages/api-platform-laravel)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21318.6k3](/packages/ecotone-laravel)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3416.9k](/packages/duncanmcclean-statamic-cargo)

PHPackages © 2026

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