PHPackages                             laravel-enso/mails - 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. laravel-enso/mails

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

laravel-enso/mails
==================

Central email layouts and components for Laravel Enso applications

1.0.13(2w ago)0268↓19.2%11MITPHPPHP ^8.2

Since May 21Pushed 2w agoCompare

[ Source](https://github.com/laravel-enso/mails)[ Packagist](https://packagist.org/packages/laravel-enso/mails)[ Docs](https://github.com/laravel-enso/mails)[ RSS](/packages/laravel-enso-mails/feed)WikiDiscussions main Synced 1w ago

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

Mails
=====

[](#mails)

[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://github.com/laravel-enso/mails/blob/main/LICENSE)[![Stable](https://camo.githubusercontent.com/84422e8aeb44d33b57f0425876941c9b1807284171887dc3ec14b248acd30e31/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f6d61696c732f762f737461626c65)](https://packagist.org/packages/laravel-enso/mails)[![Downloads](https://camo.githubusercontent.com/9002ad50f8a5f1d454f56a86bfba7ba88d8a051b00434f66a1fffc37cb831a88/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f6d61696c732f646f776e6c6f616473)](https://packagist.org/packages/laravel-enso/mails)[![PHP](https://camo.githubusercontent.com/e2df0db5111cc996698331f261bf2635d5d982b997163dd61bcd20b2f000f216/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d3838393242462e737667)](https://github.com/laravel-enso/mails/blob/main/composer.json)[![Issues](https://camo.githubusercontent.com/65943bd0d26b11f9be3baf47e16a8c0873a36fefec6f3d467632337029f38ec4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6c61726176656c2d656e736f2f6d61696c73)](https://github.com/laravel-enso/mails/issues)[![Merge Requests](https://camo.githubusercontent.com/675e809681040bb5af8212e6332af7124bf502a5effd109dccbfcd38976316ea/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d70722f6c61726176656c2d656e736f2f6d61696c73)](https://github.com/laravel-enso/mails/pulls)

Description
-----------

[](#description)

Laravel Enso Mails provides the central email design system for Laravel Enso applications. It ships modern Markdown mail layouts, reusable Blade mail components, brand tokens, and a preview catalog so framework packages and applications can migrate email templates incrementally without copying CSS or layout HTML into every mail.

The package uses MJML only at package build time. Consuming Laravel applications send compiled Blade Markdown mail views at runtime and do not need Node.js or MJML installed to send mail.

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

[](#installation)

Install the package with Composer:

```
composer require laravel-enso/mails
```

The service provider is auto-discovered by Laravel. It registers the package views, configures the Laravel Markdown mail paths, registers the built-in preview catalog, and exposes the preview route and command.

Publish the config when an application needs brand overrides:

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

This publishes:

```
config/enso/mails.php

```

View publishing is available for deliberate overrides only:

```
php artisan vendor:publish --tag=mails-views
```

::: warning Note Do not publish views just to customize brand colors, logo, spacing, or font. Use `config/enso/mails.php` for those values so applications stay on the shared layout and component system. :::

Features
--------

[](#features)

- Central Markdown mail layouts for normal and wide email bodies.
- Compatibility aliases for `mail::message`, `mail::message-wide`, `mail::transactional`, `mail::action-required`, and `mail::report`.
- Reusable Blade components for titles, tags, buttons, boxes, alerts, quotes, panels, files, metrics, tables, schedules, dividers, signatures, headers, and footers.
- Brand tokens for logo, name, URL, colors, typography, spacing, radius, footer text, legal text, and footer links.
- MJML source layout compiled into runtime Blade views.
- Runtime mail sending without Node.js or MJML.
- Local preview catalog for browser review.
- Artisan preview command for listing and rendering static HTML previews.
- Built-in boilerplate previews for transactional, action-required, report, metrics, and the full component catalog.
- Preview sections for boilerplates, Enso package-owned mail, and app-specific mail.

Usage
-----

[](#usage)

After installation, existing Laravel Markdown mail templates can keep using Laravel's standard mail namespace:

```
@component('mail::message')
@component('mail::title', ['subtitle' => 'Your account was updated successfully.'])
Account updated
@endcomponent

Hi Jane,

Your profile details were updated. No further action is needed.

@component('mail::button', ['url' => $url])
Open settings
@endcomponent

@component('mail::signature')
@endcomponent
@endcomponent
```

Applications customize the layout through `config/enso/mails.php`:

```
'brand' => [
    'name' => 'Solarlink',
    'url' => 'https://solarlink.ro',
    'logo' => 'https://solarlink.ro/images/mail-logo.png',
    'label' => 'solarlink.ro',
],

'text' => [
    'font_family' => 'Poppins, Avenir, Helvetica, Arial, sans-serif',
],

'colors' => [
    'primary' => '#4aac2a',
    'accent' => '#eb3a16',
    'link' => '#eb3a16',
    'dark' => '#121933',
],
```

The package supports common Laravel Markdown button aliases:

```
@component('mail::button', ['url' => $url, 'color' => 'red'])
Set your new password
@endcomponent
```

The aliases map to configured Enso color variants:

```
red   -> danger
blue  -> info
green -> success

```

### Preview Catalog

[](#preview-catalog)

The preview route is enabled outside production by default:

```
'preview' => [
    'enabled' => env('ENSO_MAILS_PREVIEW', env('APP_ENV') !== 'production'),
],
```

Open the catalog in a browser:

```
/enso-mails-preview

```

Open a specific preview:

```
/enso-mails-preview/password-reset
/enso-mails-preview/data-import-done
/enso-mails-preview/components

```

The route is intended for local and staging review. It does not send email; it renders preview views with fake structured data.

### Registering Package And Application Previews

[](#registering-package-and-application-previews)

Packages and applications can register their own previews through the registry. Package-owned mail previews should live in a dedicated `MailServiceProvider` and packages that use the shared mail layouts should require `laravel-enso/mails` directly in `composer.json`.

```
namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use LaravelEnso\Mails\Preview\PreviewDefinition;
use LaravelEnso\Mails\Preview\PreviewRegistry;

class MailServiceProvider extends ServiceProvider
{
    public function boot(PreviewRegistry $registry): void
    {
        $registry->register(new PreviewDefinition(
            key: 'reset-password',
            name: 'Reset Password',
            view: 'laravel-enso/core::emails.reset',
            data: [
                'name' => 'Jane Doe',
                'url' => 'https://example.test/password/reset/token',
            ],
            section: PreviewDefinition::AppSpecific,
        ));
    }
}
```

Preview data should be fake and structured. Framework previews should not hardcode application-specific brand names, colors, logos, or business logic.

### Preview Command

[](#preview-command)

List registered previews:

```
php artisan enso:mails:preview --list
```

Render one preview to stdout:

```
php artisan enso:mails:preview password-reset
```

Render every registered preview to static HTML files:

```
php artisan enso:mails:preview --output=/tmp/mail-previews
```

The command is useful for batch QA, static review, and screenshot workflows. Browser review during development usually happens through `/enso-mails-preview`.

### Package Build Flow

[](#package-build-flow)

MJML is a package development dependency. Maintainers edit:

```
resources/mjml/html/message.mjml.blade.php

```

Then compile the runtime Blade views:

```
npm run build
```

The compiler writes:

```
resources/views/vendor/mail/html/message.blade.php
resources/views/vendor/mail/html/message-wide.blade.php
resources/views/vendor/mail/html/transactional.blade.php
resources/views/vendor/mail/html/action-required.blade.php
resources/views/vendor/mail/html/report.blade.php

```

Before releasing, verify the compiled Blade views are current:

```
npm run build:check
```

Consuming applications do not run this build step at runtime.

API
---

[](#api)

### Config

[](#config)

The config namespace is:

```
enso.mails

```

Important groups:

- `brand`: name, URL, logo, and label.
- `colors`: primary, accent, link, semantic variants, dark, light, and white tokens.
- `layout`: width, wide width, background, surface, border, radius, card radius, gutter.
- `text`: font family, spacing, body, muted, and heading colors.
- `components`: button, box, file, tag, and table defaults.
- `footer`: footer text, legal text, and links.
- `markdown`: Markdown theme and path behavior.
- `preview`: preview route enablement.

### Components

[](#components)

Reusable Markdown components:

- `mail::title`
- `mail::tag`
- `mail::button`
- `mail::box`
- `mail::alert`
- `mail::quote`
- `mail::panel`
- `mail::file`
- `mail::metric`
- `mail::table`
- `mail::schedule`
- `mail::divider`
- `mail::signature`

`mail::file` accepts optional `url`, `meta`, and `icon` parameters. When `url` is present, the whole file pill is rendered as a hyperlink, which is useful for generated exports or downloadable documents.

Layout and compatibility components:

- `mail::layout`
- `mail::header`
- `mail::footer`
- `mail::subcopy`
- `mail::message`
- `mail::message-wide`
- `mail::transactional`
- `mail::action-required`
- `mail::report`

The `components` preview documents every reusable content component with a short description and a rendered example.

### Preview Registry

[](#preview-registry)

`LaravelEnso\Mails\Preview\PreviewRegistry` stores preview definitions.

`LaravelEnso\Mails\Preview\PreviewDefinition` accepts:

- `key`: route and command identifier.
- `name`: human-readable catalog label.
- `view`: Blade view name.
- `data`: fake data passed to the view.

### Commands

[](#commands)

```
php artisan enso:mails:preview
php artisan enso:mails:preview --list
php artisan enso:mails:preview {preview}
php artisan enso:mails:preview --output=/path/to/output
```

Depends On
----------

[](#depends-on)

- PHP `^8.2`
- Laravel Framework `^12.0|^13.0`
- `mjml` as a package development dependency for compiling source MJML into runtime Blade views.

Contributions
-------------

[](#contributions)

are welcome. Pull requests are great, but issues are good too.

Thank you to all the people who already contributed to Enso!

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance96

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity53

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

14

Last Release

19d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16073274?v=4)[Adrian Ocneanu](/maintainers/aocneanu)[@aocneanu](https://github.com/aocneanu)

---

Top Contributors

[![aocneanu](https://avatars.githubusercontent.com/u/16073274?v=4)](https://github.com/aocneanu "aocneanu (16 commits)")

---

Tags

mailemailmarkdownmailslaravel-enso

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/laravel-enso-mails/health.svg)

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

###  Alternatives

[zbateson/mail-mime-parser

MIME email message parser

54351.9M85](/packages/zbateson-mail-mime-parser)[ddeboer/imap

Object-oriented IMAP for PHP

9324.0M14](/packages/ddeboer-imap)[propaganistas/laravel-disposable-email

Disposable email validator

6012.9M7](/packages/propaganistas-laravel-disposable-email)[coconutcraig/laravel-postmark

Laravel package for sending mail via the Postmark API

2163.1M1](/packages/coconutcraig-laravel-postmark)[voku/email-check

email-check (syntax, dns, trash, ...) library

534.1M6](/packages/voku-email-check)[opcodesio/mail-parser

Parse emails without the mailparse extension

228.1M8](/packages/opcodesio-mail-parser)

PHPackages © 2026

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