PHPackages                             nettsite/nettmail-laravel - 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. nettsite/nettmail-laravel

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

nettsite/nettmail-laravel
=========================

NettMail Laravel package - Eloquent models, service provider, queued jobs, and Livewire admin UI for the NettMail core package

v0.2.4(1mo ago)079[1 PRs](https://github.com/nettsite/nettmail-laravel/pulls)MITPHPPHP ^8.2CI passing

Since Jun 12Pushed 1mo agoCompare

[ Source](https://github.com/nettsite/nettmail-laravel)[ Packagist](https://packagist.org/packages/nettsite/nettmail-laravel)[ Docs](https://github.com/nettsite/nettmail-laravel)[ GitHub Sponsors](https://github.com/Nettsite)[ RSS](/packages/nettsite-nettmail-laravel/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (17)Versions (8)Used By (0)

NettMail Laravel
================

[](#nettmail-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/fca53198d96f1d004153b0d9579833020ac93800c3b93ba02d062797ca7f90c7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e657474736974652f6e6574746d61696c2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nettsite/nettmail-laravel)[![GitHub Tests Action Status](https://github.com/nettsite/nettmail-laravel/actions/workflows/run-tests.yml/badge.svg)](https://github.com/nettsite/nettmail-laravel/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://github.com/nettsite/nettmail-laravel/actions/workflows/fix-php-code-style-issues.yml/badge.svg)](https://github.com/nettsite/nettmail-laravel/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/f0939bb4e308d5893523e1733220f92bb20a005b00240d04f0872ba04bf674fe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e657474736974652f6e6574746d61696c2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nettsite/nettmail-laravel)

Laravel adapter for [`nettmail/core`](https://github.com/nettsite/nettmail-core) — Eloquent models, service provider, queued jobs, and Livewire admin UI for the NettMail email package.

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

[](#installation)

You can install the package via composer:

```
composer require nettsite/nettmail-laravel
```

Run the migrations (the package loads its own migrations — do not publish them, or they will run twice):

```
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="nettmail-config"
```

The config file lets you configure the mail driver (`php`, `smtp`, `resend`, `mailersend`, `mailgun`, `postmark`, `ses`), default sender identity, bounce mailbox, sending rate limit, retention period, and CAN-SPAM compliance address. See `config/nettmail.php` after publishing for the full list of options.

Optionally, you can publish the views using

```
php artisan vendor:publish --tag="nettmail-views"
```

The template editor uses [GrapesJS](https://grapesjs.com) with the newsletter preset, bundled as a prebuilt asset — fully self-hosted, no external service or account required.

Publish the editor asset with:

```
php artisan vendor:publish --tag="nettmail-assets"
```

This copies `grapesjs-editor.js` and `grapesjs-editor.css` to `public/vendor/nettmail`. Re-run this command after upgrading the package to pick up editor updates.

The admin UI is mounted at `/nettmail` (configurable via `NETTMAIL_ROUTES_PREFIX`) behind the `web` and `auth` middleware (configurable via `routes.middleware`). It includes pages for the dashboard, contacts, lists, segments, campaigns, templates, and settings.

Usage
-----

[](#usage)

```
use NettSite\NettMail\Facades\NettMail;

NettMail::eraseContact($contactId);
```

Scheduler
---------

[](#scheduler)

NettMail ships several artisan commands that should run on a schedule. Register them in your host app's `bootstrap/app.php`:

```
use Illuminate\Console\Scheduling\Schedule;

->withSchedule(function (Schedule $schedule): void {
    // Sends scheduled broadcast campaigns once their send time arrives.
    $schedule->command('nettmail:dispatch-scheduled')->everyMinute();

    // Polls the configured bounce mailbox for DSNs and complaints.
    $schedule->command('nettmail:poll-bounces')->everyFiveMinutes();

    // Purges send logs and events older than `retention.send_log_years`.
    $schedule->command('nettmail:purge')->daily();
})
```

If you've registered a contact source (see below), keep contacts in sync on a schedule too:

```
$schedule->command('nettmail:sync-contacts merlin')->hourly();
```

Contact sources
---------------

[](#contact-sources)

NettMail keeps its own copy of contacts (`nettmail_contacts`) and syncs them from your host app via a `ContactSourceContract` implementation, registered with `ContactSourceRegistry`.

```
use Nettsite\NettMail\Core\Contracts\ContactSourceContract;

class MerlinClientContactSource implements ContactSourceContract
{
    public function label(): string
    {
        return 'Merlin clients';
    }

    public function key(): string
    {
        return 'merlin';
    }

    /**
     * @return iterable
     */
    public function contacts(): iterable
    {
        foreach (Client::query()->whereNotNull('email')->cursor() as $client) {
            yield [
                'email' => $client->email,
                'first_name' => $client->first_name,
                'last_name' => $client->last_name,
                'phone' => $client->phone,
                'metadata' => ['client_id' => $client->id],
                'source_id' => $client->id,
            ];
        }
    }

    /**
     * @return array{email: string, first_name?: string, last_name?: string, phone?: string, metadata?: array, source_id?: string|int}|null
     */
    public function findContact(string|int $sourceId): ?array
    {
        $client = Client::find($sourceId);

        if ($client === null) {
            return null;
        }

        return [
            'email' => $client->email,
            'first_name' => $client->first_name,
            'last_name' => $client->last_name,
            'phone' => $client->phone,
            'metadata' => ['client_id' => $client->id],
            'source_id' => $client->id,
        ];
    }
}
```

Register it in a service provider's `boot()` method:

```
use NettSite\NettMail\Contacts\ContactSourceRegistry;

public function boot(ContactSourceRegistry $registry): void
{
    $registry->register(new MerlinClientContactSource);
}
```

Then sync contacts on demand or via the scheduler:

```
php artisan nettmail:sync-contacts merlin
```

Navigation
----------

[](#navigation)

Add links to the NettMail admin pages in your host app's navigation. Routes are named `nettmail.*` and the configured nav group label is available via `config('nettmail.nav_group')`:

```
@if (Route::has('nettmail.dashboard'))

        Dashboard
        Contacts
        Lists
        Segments
        Campaigns
        Templates
        Settings

@endif
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Nettsite](https://github.com/nettsite)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance93

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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

6

Last Release

43d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11553107?v=4)[William Nettmann](/maintainers/NettSite)[@nettsite](https://github.com/nettsite)

---

Top Contributors

[![nettsite](https://avatars.githubusercontent.com/u/11553107?v=4)](https://github.com/nettsite "nettsite (31 commits)")

---

Tags

laravelnettmail

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/nettsite-nettmail-laravel/health.svg)

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.5k](/packages/spatie-laravel-permission)[spatie/laravel-health

Monitor the health of a Laravel application

87912.0M177](/packages/spatie-laravel-health)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.6k](/packages/simplestats-io-laravel-client)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M347](/packages/psalm-plugin-laravel)[filament/support

Core helper methods and foundation code for all Filament packages.

2331.0M271](/packages/filament-support)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24957.5k](/packages/vormkracht10-laravel-mails)

PHPackages © 2026

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