PHPackages                             casperboone/laravel-expiring-email - 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. casperboone/laravel-expiring-email

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

casperboone/laravel-expiring-email
==================================

Auto-expiring email notifications

1.0.0(1y ago)0294MITPHPPHP &gt;=8.4CI passing

Since Mar 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/casperboone/laravel-expiring-email)[ Packagist](https://packagist.org/packages/casperboone/laravel-expiring-email)[ Docs](https://github.com/casperboone/laravel-expiring-email)[ GitHub Sponsors](https://github.com/casperboone)[ RSS](/packages/casperboone-laravel-expiring-email/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (6)Versions (5)Used By (0)

📬 Auto-expiring email notifications
===================================

[](#-auto-expiring-email-notifications)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ce5b67924c43d63c99de24a76933aa08674ea1b41ab97d39c72ba9acc1eb1c5e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636173706572626f6f6e652f6c61726176656c2d6578706972696e672d656d61696c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/casperboone/laravel-expiring-email)[![GitHub Tests Action Status](https://camo.githubusercontent.com/261457fcb7aab438ce427aa213caa59774a16437ac1f5f7a5859a886a4f17d4f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f636173706572626f6f6e652f6c61726176656c2d6578706972696e672d656d61696c2f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/casperboone/laravel-expiring-email/actions?query=workflow%3ATests+branch%3Amaster)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/13b767b9ab8e8125d2043b07dbca3a696d4004ebb4d9427a3f3133872612f228/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f636173706572626f6f6e652f6c61726176656c2d6578706972696e672d656d61696c2f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/casperboone/laravel-expiring-email/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/394972c18a4124d60825a75d8f0d4610f63d0de7be98732eaff2bdabb3941a7a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636173706572626f6f6e652f6c61726176656c2d6578706972696e672d656d61696c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/casperboone/laravel-expiring-email)

This package allows you to easily send expiring emails. This is useful for cases where you do not want to send sensitive data over email directly and you want to make that no sensitive information is kept in a recipient's mailbox without having control over that data.

By using the expiring email driver of this package instead of the regular email driver in a notification, all that is sent to the receiver is a signed and expiring link to the original content of the email.

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

[](#installation)

You can install the package via composer:

```
composer require casperboone/laravel-expiring-email
```

You should publish and run the migrations with:

```
php artisan vendor:publish --provider="CasperBoone\LaravelExpiringEmail\LaravelExpiringEmailServiceProvider" --tag="expiring-email-migrations"
php artisan migrate
```

You can optionally publish the config file with:

```
php artisan vendor:publish --provider="CasperBoone\LaravelExpiringEmail\LaravelExpiringEmailServiceProvider" --tag="expiring-email-config"
```

You can optionally publish the views to customize the replacement email with:

```
php artisan vendor:publish --provider="CasperBoone\LaravelExpiringEmail\LaravelExpiringEmailServiceProvider" --tag="expiring-email-views"
```

An email immediately becomes inaccessible after the expiration date. However, to also remove the emails from your database after the expiration date, you should [schedule](https://laravel.com/docs/8.x/scheduling#defining-schedules) "clean" command to be run daily.

```
// app/Console/Kernel.php

protected function schedule(Schedule $schedule)
{
    $schedule->command(CleanExpiredEmails::class)->daily();
}
```

Usage
-----

[](#usage)

The basic usage of this package is very easy, all you need to do is replace `'email'` in your `via()` method of a [notification](https://laravel.com/docs/8.x/notifications) to the expiring email notification channel.

```
 public function via($notifiable): array
 {
-    return ['mail'];
+    return [ExpiringEmailChannel::class];
 }
```

This sends an email to the original receiver with a [signed](https://laravel.com/docs/8.x/urls#signed-urls) expiring link to the content of the original email. The default expiration date is set in the config file but can be set on a case-by-case basis in the notification using `ExpiringMailMessage`:

```
 public function toMail($notifiable): MailMessage
 {
-    return (new MailMessage)
+    return (new ExpiringMailMessage)
         ->subject('Secret document')
+        ->expiresInDays(7)
         ->markdown('secret_document_email');
 }
```

Development
-----------

[](#development)

**Testing**

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

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

[](#security-vulnerabilities)

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

Credits
-------

[](#credits)

- [Casper Boone](https://github.com/casperboone)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance43

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity73

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

Total

4

Last Release

458d ago

Major Versions

0.1.1 → 1.0.02025-02-08

PHP version history (2 changes)0.0.1PHP &gt;=7.4

1.0.0PHP &gt;=8.4

### Community

Maintainers

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

---

Top Contributors

[![casperboone](https://avatars.githubusercontent.com/u/15815208?v=4)](https://github.com/casperboone "casperboone (29 commits)")

---

Tags

casperboonelaravel-expiring-email

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/casperboone-laravel-expiring-email/health.svg)

```
[![Health](https://phpackages.com/badges/casperboone-laravel-expiring-email/health.svg)](https://phpackages.com/packages/casperboone-laravel-expiring-email)
```

###  Alternatives

[vormkracht10/laravel-mails

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

24149.7k](/packages/vormkracht10-laravel-mails)[xammie/mailbook

Laravel Mail Explorer

482458.3k1](/packages/xammie-mailbook)[spatie/laravel-notification-log

Log notifications sent by your Laravel app

207902.8k](/packages/spatie-laravel-notification-log)[illuminate/mail

The Illuminate Mail package.

5910.1M391](/packages/illuminate-mail)[wnx/laravel-sends

Keep track of outgoing emails in your Laravel application.

200427.3k](/packages/wnx-laravel-sends)[spatie/laravel-discord-alerts

Send a message to Discord

151408.0k](/packages/spatie-laravel-discord-alerts)

PHPackages © 2026

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