PHPackages                             empinet/laravel-outbound-mail-log - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. empinet/laravel-outbound-mail-log

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

empinet/laravel-outbound-mail-log
=================================

Log outbound emails sent by Laravel into a database table.

v1.0.1(1mo ago)03↑2900%MITPHPPHP ^8.2CI passing

Since Mar 29Pushed 1mo agoCompare

[ Source](https://github.com/Empinet/laravel-outbound-mail-log)[ Packagist](https://packagist.org/packages/empinet/laravel-outbound-mail-log)[ Docs](https://github.com/empinet/laravel-outbound-mail-log)[ RSS](/packages/empinet-laravel-outbound-mail-log/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (3)Used By (0)

Laravel Outbound Mail Log
=========================

[](#laravel-outbound-mail-log)

[![Tests](https://camo.githubusercontent.com/1f6b38f5461b17acbb28151414d86f68973e779b27d37fdded7fbe782339ab49/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f656d70696e65742f6c61726176656c2d6f7574626f756e642d6d61696c2d6c6f672f72756e2d74657374732e796d6c3f6272616e63683d6d6173746572266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/empinet/laravel-outbound-mail-log/actions/workflows/run-tests.yml)[![Quality](https://camo.githubusercontent.com/61184bdd5f6f7ac1c2bc46b16b8f5cea4c5646827c97688f095b3e720ae01604/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f656d70696e65742f6c61726176656c2d6f7574626f756e642d6d61696c2d6c6f672f7175616c6974792e796d6c3f6272616e63683d6d6173746572266c6162656c3d7175616c697479267374796c653d666c61742d737175617265)](https://github.com/empinet/laravel-outbound-mail-log/actions/workflows/quality.yml)[![Latest Version on Packagist](https://camo.githubusercontent.com/99d74c37e19da321ebd0c22866a526a64c9e26121d0822cef26dc99c073644bd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656d70696e65742f6c61726176656c2d6f7574626f756e642d6d61696c2d6c6f673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/empinet/laravel-outbound-mail-log)[![Total Downloads](https://camo.githubusercontent.com/71cd25a10ecad892afe0689d760b46f05f0ad77e73d426d25b96830a4535bfaf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656d70696e65742f6c61726176656c2d6f7574626f756e642d6d61696c2d6c6f673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/empinet/laravel-outbound-mail-log)

Log outbound emails sent by Laravel into a database table.

This package listens to Laravel's mail sending events and stores outgoing email metadata (subject, recipients, sender, body, headers, attachments, mailable/notification class, mailer, and send status) so you can inspect what was sent.

What gets logged
----------------

[](#what-gets-logged)

- subject
- from / to / cc / bcc
- HTML or text body (configurable)
- headers (configurable)
- attachment filenames
- mailable or notification class (when available)
- mailer name
- status (`sending` then `sent`)
- sent timestamp

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

[](#installation)

Install the package with Composer:

```
composer require empinet/laravel-outbound-mail-log
```

Publish and run the migration:

```
php artisan vendor:publish --tag="outbound-mail-log-migrations"
php artisan migrate
```

You can also use the default Laravel migration publish tag:

```
php artisan vendor:publish --tag="migrations"
php artisan migrate
```

Publish the config file:

```
php artisan vendor:publish --tag="outbound-mail-log-config"
```

You can also use the default Laravel config publish tag:

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

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

[](#configuration)

The package ships disabled by default.

Set this in your `.env`:

```
OUTBOUND_MAIL_LOG_ENABLED=true
```

Available config options (`config/outbound-mail-log.php`):

```
return [
    'enabled' => env('OUTBOUND_MAIL_LOG_ENABLED', false),
    'cleanup_records_after' => env('OUTBOUND_MAIL_LOG_CLEANUP_RECORDS_AFTER', false),
    'log_headers' => env('OUTBOUND_MAIL_LOG_LOG_HEADERS', true),
    'log_body' => env('OUTBOUND_MAIL_LOG_LOG_BODY', true),
];
```

Recommended `.env` values for local/testing:

```
OUTBOUND_MAIL_LOG_ENABLED=true
OUTBOUND_MAIL_LOG_LOG_BODY=true
OUTBOUND_MAIL_LOG_LOG_HEADERS=true
OUTBOUND_MAIL_LOG_CLEANUP_RECORDS_AFTER=false
```

For production, consider setting `OUTBOUND_MAIL_LOG_LOG_BODY=false` if emails may contain sensitive content.

Usage
-----

[](#usage)

After installing, publishing migrations, and enabling the package, send mail normally using Laravel mailables/notifications.

```
use Illuminate\Support\Facades\Mail;

Mail::raw('Hello from the app', function ($message): void {
    $message->to('user@example.com')
        ->from('noreply@example.com')
        ->subject('Test message');
});
```

Then inspect logs from your app:

```
use Empinet\OutboundMailLog\Models\OutboundMailLog;

$latest = OutboundMailLog::query()
    ->latest('id')
    ->first();
```

Cleanup command
---------------

[](#cleanup-command)

To remove old records based on `OUTBOUND_MAIL_LOG_CLEANUP_RECORDS_AFTER`, run:

```
php artisan outbound-mail-log:cleanup
```

Set `OUTBOUND_MAIL_LOG_CLEANUP_RECORDS_AFTER=false` to disable cleanup.

To schedule cleanup daily, add this in your `routes/console.php`:

```
use Illuminate\Support\Facades\Schedule;

Schedule::command('outbound-mail-log:cleanup')->daily();
```

Notes
-----

[](#notes)

- A log entry is created when sending starts (`sending`) and marked as `sent` after Laravel dispatches `MessageSent`.
- The package supports Mailables, Notification mail channel messages, and closure/raw emails.

Testing
-------

[](#testing)

```
composer test
```

Releasing
---------

[](#releasing)

- Releases are tag-based.
- Every push to `master` triggers the `release` workflow and creates the next patch tag automatically.
- If no tag exists yet, the workflow bootstraps the first release at `v1.0.0`.
- You can also run the `release` workflow manually and pass an explicit version like `1.2.0`.
- Packagist updates are handled via Packagist auto-update integration.

If Composer shows `could not detect the root package version` in local development, that is normal before your first release tag. It does not affect package behavior.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for recent changes.

License
-------

[](#license)

The MIT License (MIT). See [LICENSE](LICENSE.md).

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance90

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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

2

Last Release

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/87c0c49081a79a456bf9730ec426e840236cf7ed3ef0596fe31f62c45b0fcf38?d=identicon)[hazaveh](/maintainers/hazaveh)

---

Top Contributors

[![hazaveh](https://avatars.githubusercontent.com/u/12988865?v=4)](https://github.com/hazaveh "hazaveh (9 commits)")

---

Tags

loglaravelmailemailempinet

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/empinet-laravel-outbound-mail-log/health.svg)

```
[![Health](https://phpackages.com/badges/empinet-laravel-outbound-mail-log/health.svg)](https://phpackages.com/packages/empinet-laravel-outbound-mail-log)
```

###  Alternatives

[spatie/laravel-activitylog

A very simple activity logger to monitor the users of your website or application

5.8k45.4M309](/packages/spatie-laravel-activitylog)[masterro/laravel-mail-viewer

Easily view in browser outgoing emails.

6392.1k](/packages/masterro-laravel-mail-viewer)[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[guanguans/laravel-exception-notify

Monitor exception and report to the notification channels(Log、Mail、AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

14642.7k1](/packages/guanguans-laravel-exception-notify)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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