PHPackages                             pod-point/laravel-mail-export - 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. pod-point/laravel-mail-export

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

pod-point/laravel-mail-export
=============================

A mailable trait to export mails to a storage disk once being sent

2.2.0(1y ago)750.2k↓37.7%6[1 issues](https://github.com/Pod-Point/laravel-mail-export/issues)[2 PRs](https://github.com/Pod-Point/laravel-mail-export/pulls)MITPHPPHP ^8.1

Since Mar 30Pushed 1y ago8 watchersCompare

[ Source](https://github.com/Pod-Point/laravel-mail-export)[ Packagist](https://packagist.org/packages/pod-point/laravel-mail-export)[ Docs](https://github.com/pod-point/laravel-mail-export)[ RSS](/packages/pod-point-laravel-mail-export/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (13)Used By (0)

Laravel Mail Export
===================

[](#laravel-mail-export)

[![Latest Version on Packagist](https://camo.githubusercontent.com/faeb9e3da0bea9bb3a73518d79bffcac904585b8be58c3671ce524f6d8ab9356/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706f642d706f696e742f6c61726176656c2d6d61696c2d6578706f72742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pod-point/laravel-mail-export)[![tests](https://github.com/Pod-Point/laravel-mail-export/actions/workflows/run-tests.yml/badge.svg?branch=2.x)](https://github.com/Pod-Point/laravel-mail-export/actions/workflows/run-tests.yml)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/21a3b852959fbbc2c2dcfaa9919874da514800f1e66524e7038652dcba0c33a6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706f642d706f696e742f6c61726176656c2d6d61696c2d6578706f72742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pod-point/laravel-mail-export)

This package can export any mail sent with Laravel's `Mailable` class to any desired filesystem disk and path as a `.eml` file.

This can be useful when wanting to store emails sent for archive purposes.

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

[](#installation)

You can install the package via composer:

For Laravel 9.x, 10.x, 11.x (requires PHP version 8.2 or higher)

```
composer require pod-point/laravel-mail-export
```

For Laravel 7.x and 8.x

```
composer require pod-point/laravel-mail-export:^1.0
```

For Laravel 5.x and 6.x

```
composer require pod-point/laravel-mail-export:^0.1
```

### Publishing the config file

[](#publishing-the-config-file)

The configuration for this package comes with some sensible values but you can optionally publish the config file with:

```
php artisan vendor:publish --provider="PodPoint\MailExport\MailExportServiceProvider"
```

You will be able to specify:

- `enabled`: whether this package is enabled or not. Once installed, it's enabled by default but the `MAIL_EXPORT` environment variable can be used to configure this.
- `disk`: which disk to use by default. `null` will use the default disk from your application filesystem.
- `path`: the default path, within the configured disk, where mail will be exported.

See our [`config/mail-export.php`](config/mail-export.php) for more details.

Usage
-----

[](#usage)

Simply add the `Exportable` trait and the `ShouldExport` interface to any Mailable class that you want to persist into any storage disk.

```
