PHPackages                             dinubo/laravel-mailer - 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. dinubo/laravel-mailer

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

dinubo/laravel-mailer
=====================

Schedule and send segmented Laravel newsletters with per-recipient placeholders, open/click tracking, unsubscribe handling, provider webhooks (Postmark, Resend), and a built-in admin UI.

v0.1.0(today)02↑2900%MITPHPPHP ^8.1CI passing

Since Jun 10Pushed todayCompare

[ Source](https://github.com/dinubo/laravel-mailer)[ Packagist](https://packagist.org/packages/dinubo/laravel-mailer)[ Docs](https://github.com/dinubo/laravel-mailer)[ RSS](/packages/dinubo-laravel-mailer/feed)WikiDiscussions main Synced today

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

Mailer
======

[](#mailer)

[![Latest Version on Packagist](https://camo.githubusercontent.com/64899dd42dab2ce24a60e5b9975d912a8fed277061c1d06893c970abefdd2356/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64696e75626f2f6c61726176656c2d6d61696c65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dinubo/laravel-mailer)[![Tests](https://camo.githubusercontent.com/da4c477d91f2714ba28216c802ff6cc80b66be74002badd92d0234a3bc94b7f5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f64696e75626f2f6c61726176656c2d6d61696c65722f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/dinubo/laravel-mailer/actions/workflows/tests.yml)[![Total Downloads](https://camo.githubusercontent.com/77600b5573bcbda893ade60f2d88b4147ba8151a960fd57fed7045a0f4f3bc34/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64696e75626f2f6c61726176656c2d6d61696c65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dinubo/laravel-mailer)

A Laravel newsletter / mailer package: schedule and send segmented newsletters, resolve per-recipient placeholders, track opens and clicks, handle unsubscribes, and process provider webhooks (Postmark, Resend) — with a built-in admin UI.

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

[](#installation)

Via Composer:

```
composer require dinubo/laravel-mailer
```

The service provider and the package's migrations are auto-discovered. Run them:

```
php artisan migrate
```

Publish whatever you want to customise:

```
php artisan vendor:publish --tag=mailer.config      # config/mailer.php
php artisan vendor:publish --tag=mailer.views       # admin Blade views
php artisan vendor:publish --tag=mailer.migrations  # only if you need to edit the schema
```

Usage
-----

[](#usage)

### Routes

[](#routes)

All routes are mounted under the `/mailer` prefix and named with a `mailer.`prefix. The admin UI lives at `/mailer/newsletters`. Middleware is configurable per group (`user`, `admin`, `callback`) in `config/mailer.php`.

GroupExamplesuser`mailer.open`, `mailer.click`, `mailer.unsubscribe`admin`mailer.newsletters.*`, `mailer.newsletters.statistics.*`callback`mailer.callback.postmark`, `mailer.callback.resend`The callback (webhook) routes verify the provider signature when the matching secret is configured (see [Webhooks](#webhooks)); the `mailer.middleware.callback`group is available for any additional middleware.

### Recipients

[](#recipients)

By default newsletters are sent to your application's configured user provider model (`config('auth.providers.users.model')`). Override it in `config/mailer.php`via `recipient_model`.

### Placeholders, filters &amp; segments (registrar)

[](#placeholders-filters--segments-registrar)

Placeholders and filters use closures, so they are registered on the `Mailer`class rather than stored in config (this keeps config cacheable). Register them from a service provider's `boot()` method:

```
use Dinubo\Mailer\Mailer;
use Dinubo\Mailer\Placeholder;
use Dinubo\Mailer\Filter;
use Dinubo\Mailer\Segment;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;

// Available as {{name}} in a newsletter subject/body (plain substitution, not Blade).
Mailer::placeholders([
    Placeholder::make('name', fn (Model $recipient) => $recipient->name),
    Placeholder::make('site', 'Acme Inc.'),
]);

// Global recipient filter, applied to every send.
Mailer::filter(Filter::make(
    query: fn (Builder $query, $newsletter) => $query->whereNotNull('email_verified_at'),
));

// Segments power the admin dropdown. A built-in "all" (All Users, no filter) is
// always available; register more, each with an optional filter:
Mailer::segments([
    Segment::make('verified', 'Verified users')->filter(Filter::make(
        query: fn (Builder $query, $newsletter) => $query->whereNotNull('email_verified_at'),
    )),
]);
```

A `Filter` may define a `query:` closure (constrains the recipient query) and/or a `collection:` closure (post-filters the resulting collection).

### Events &amp; actions

[](#events--actions)

Trigger event-scheduled newsletters from your app, and compute extra per-recipient placeholders at send time:

```
use Dinubo\Mailer\Mailer;
use Dinubo\Mailer\Event;
use Dinubo\Mailer\Placeholder;
use Illuminate\Database\Eloquent\Model;

Mailer::events([
    Event::make('signup', 'On signup')
        ->placeholders([Placeholder::make('plan', fn (Model $user) => $user->plan)]),
]);

// Elsewhere in your app — schedules any active newsletters bound to this event:
Mailer::event('signup', $user);
```

`Action`s work similarly (`Action::make(...)->execute(...)`, registered via `Mailer::actions([...])`) for placeholders that run logic per recipient.

### Admin access

[](#admin-access)

The admin UI (`/mailer/newsletters`) is gated by the `admin` middleware group, which by default only allows the `local` environment. Authorize real users with `Mailer::auth()`:

```
use Dinubo\Mailer\Mailer;
use Illuminate\Http\Request;

Mailer::auth(fn (Request $request) => (bool) $request->user()?->is_admin);
```

### Webhooks

[](#webhooks)

Bounce/complaint webhooks from Postmark and Resend update delivery state. Set the matching secret to enable signature verification (without it, requests are accepted and a warning is logged):

```
# Sent by Postmark as HTTP Basic Auth — set the webhook URL to
# https://user:SECRET@your-app.test/mailer/callback/postmark
MAILER_POSTMARK_WEBHOOK_SECRET=...

# Resend (Svix) signing secret
MAILER_RESEND_WEBHOOK_SECRET=whsec_...
```

### Sending

[](#sending)

Newsletters scheduled in the admin UI are dispatched by the scheduler command. Add it to your console schedule:

```
$schedule->command('mailer:newsletters')->everyFifteenMinutes();
```

Change log
----------

[](#change-log)

Please see the [changelog](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

The package uses [orchestra/testbench](https://github.com/orchestral/testbench):

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

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

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Dinubo](https://github.com/dinubo)
- [All Contributors](../../contributors)

License
-------

[](#license)

MIT. Please see the [license file](LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance100

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

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

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/14969790?v=4)[Petros](/maintainers/pellaras)[@pellaras](https://github.com/pellaras)

---

Tags

laravelmailer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dinubo-laravel-mailer/health.svg)

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

###  Alternatives

[vemcogroup/laravel-sparkpost-driver

SparkPost driver to use with Laravel 6.x|7.x|8.x|9.x|10.x

421.7M1](/packages/vemcogroup-laravel-sparkpost-driver)[ecotone/laravel

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

21313.7k3](/packages/ecotone-laravel)[hafael/azure-mailer-driver

Supercharge your Laravel or Symfony app with Microsoft Azure Communication Services (ACS)! Effortlessly add email, chat, voice, video, and telephony-over-IP for next-level communication. 🚀

15122.2k](/packages/hafael-azure-mailer-driver)

PHPackages © 2026

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