https://github.com/pod-point/laravel-mail-export
A simple mailable trait and interface to export mails to a storage disk once being sent.
https://github.com/pod-point/laravel-mail-export
archive backup laravel mail storage
Last synced: 3 months ago
JSON representation
A simple mailable trait and interface to export mails to a storage disk once being sent.
- Host: GitHub
- URL: https://github.com/pod-point/laravel-mail-export
- Owner: Pod-Point
- License: mit
- Created: 2021-03-08T11:03:08.000Z (over 5 years ago)
- Default Branch: 2.x
- Last Pushed: 2024-11-07T13:46:38.000Z (over 1 year ago)
- Last Synced: 2025-03-20T17:52:50.933Z (over 1 year ago)
- Topics: archive, backup, laravel, mail, storage
- Language: PHP
- Homepage: https://pod-point.com
- Size: 26.4 KB
- Stars: 6
- Watchers: 9
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Laravel Mail Export
[](https://packagist.org/packages/pod-point/laravel-mail-export)
[](https://github.com/Pod-Point/laravel-mail-export/actions/workflows/run-tests.yml)
[](LICENSE.md)
[](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
You can install the package via composer:
For Laravel 9.x, 10.x, 11.x (requires PHP version 8.2 or higher)
```bash
composer require pod-point/laravel-mail-export
```
For Laravel 7.x and 8.x
```bash
composer require pod-point/laravel-mail-export:^1.0
```
For Laravel 5.x and 6.x
```bash
composer require pod-point/laravel-mail-export:^0.1
```
### Publishing the config file
The configuration for this package comes with some sensible values but you can optionally publish the config file with:
```bash
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
Simply add the `Exportable` trait and the `ShouldExport` interface to any Mailable class that you want to persist into any storage disk.
```php
user())->send(new OrderShipped($order));
```
Even with Notifications too:
```php
order))->to($notifiable->email);
}
}
```
## Testing
Run the tests with:
```bash
composer test
```
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Credits
- [themsaid](https://github.com/themsaid) and Spatie's [laravel-mail-preview](https://github.com/spatie/laravel-mail-preview) for some inspiration
- [Laravel Package Development](https://laravelpackage.com) documentation by [John Braun](https://github.com/Jhnbrn90)
- [Pod Point](https://github.com/pod-point)
- [All Contributors](https://github.com/pod-point/laravel-mail-export/graphs/contributors)
## License
The MIT License (MIT). Please see [License File](LICENCE.md) for more information.
---

Travel shouldn't damage the earth 🌍
Made with ❤️ at [Pod Point](https://pod-point.com)