{"id":27370044,"url":"https://github.com/pod-point/laravel-mail-export","last_synced_at":"2026-03-15T23:37:31.624Z","repository":{"id":39814019,"uuid":"345626185","full_name":"Pod-Point/laravel-mail-export","owner":"Pod-Point","description":"A simple mailable trait and interface to export mails to a storage disk once being sent.","archived":false,"fork":false,"pushed_at":"2024-11-07T13:46:38.000Z","size":27,"stargazers_count":6,"open_issues_count":2,"forks_count":4,"subscribers_count":9,"default_branch":"2.x","last_synced_at":"2025-03-20T17:52:50.933Z","etag":null,"topics":["archive","backup","laravel","mail","storage"],"latest_commit_sha":null,"homepage":"https://pod-point.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Pod-Point.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-03-08T11:03:08.000Z","updated_at":"2024-12-07T14:40:12.000Z","dependencies_parsed_at":"2023-11-08T12:34:01.754Z","dependency_job_id":"8d849a3b-f884-494e-9f64-df1dcfeeb7d6","html_url":"https://github.com/Pod-Point/laravel-mail-export","commit_stats":{"total_commits":6,"total_committers":3,"mean_commits":2.0,"dds":"0.33333333333333337","last_synced_commit":"26f5b2115d055440762128f93973bb66213ec683"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pod-Point%2Flaravel-mail-export","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pod-Point%2Flaravel-mail-export/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pod-Point%2Flaravel-mail-export/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pod-Point%2Flaravel-mail-export/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pod-Point","download_url":"https://codeload.github.com/Pod-Point/laravel-mail-export/tar.gz/refs/heads/2.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248688176,"owners_count":21145762,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["archive","backup","laravel","mail","storage"],"created_at":"2025-04-13T08:47:47.978Z","updated_at":"2026-03-15T23:37:31.579Z","avatar_url":"https://github.com/Pod-Point.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Mail Export\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/pod-point/laravel-mail-export.svg?style=flat-square)](https://packagist.org/packages/pod-point/laravel-mail-export)\n[![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)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Total Downloads](https://img.shields.io/packagist/dt/pod-point/laravel-mail-export.svg?style=flat-square)](https://packagist.org/packages/pod-point/laravel-mail-export)\n\nThis package can export any mail sent with Laravel's `Mailable` class to any desired filesystem disk and path as a `.eml` file.\n\nThis can be useful when wanting to store emails sent for archive purposes.\n\n## Installation\n\nYou can install the package via composer:\n\nFor Laravel 9.x, 10.x, 11.x (requires PHP version 8.2 or higher)\n\n```bash\ncomposer require pod-point/laravel-mail-export\n```\n\nFor Laravel 7.x and 8.x\n\n```bash\ncomposer require pod-point/laravel-mail-export:^1.0\n```\n\nFor Laravel 5.x and 6.x\n\n```bash\ncomposer require pod-point/laravel-mail-export:^0.1\n```\n\n### Publishing the config file\n\nThe configuration for this package comes with some sensible values but you can optionally publish the config file with:\n\n```bash\nphp artisan vendor:publish --provider=\"PodPoint\\MailExport\\MailExportServiceProvider\"\n```\n\nYou will be able to specify:\n\n* `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.\n* `disk`: which disk to use by default. `null` will use the default disk from your application filesystem.\n* `path`: the default path, within the configured disk, where mail will be exported.\n\nSee our [`config/mail-export.php`](config/mail-export.php) for more details.\n\n## Usage\n\nSimply add the `Exportable` trait and the `ShouldExport` interface to any Mailable class that you want to persist into any storage disk.\n\n```php\n\u003c?php\n\nnamespace App\\Mail;\n\nuse Illuminate\\Mail\\Mailable;\nuse PodPoint\\MailExport\\Concerns\\Exportable;\nuse PodPoint\\MailExport\\Contracts\\ShouldExport;\n\nclass OrderShipped extends Mailable implements ShouldExport\n{\n    use Exportable;\n\n    // ...\n}\n```\n\nThis will use the default filesystem `disk` and `path` from the configuration and will also generate a unique `filename` for you.\n\nThe default filename is using a timestamp, the mail recipients, the subject and will look like so:\n\n```\n2021_03_26_150142_jane_at_example_com_this_is_the_subject.eml\n```\n\nYou can also specify the `disk`, `path` or `filename` to use for a specific Mailable using properties:\n\n```php\n\u003c?php\n\nnamespace App\\Mail;\n\nuse Illuminate\\Mail\\Mailable;\nuse PodPoint\\MailExport\\Concerns\\Exportable;\nuse PodPoint\\MailExport\\Contracts\\ShouldExport;\n\nclass OrderShipped extends Mailable implements ShouldExport\n{\n    use Exportable;\n\n    public $exportDisk = 'some_disk';\n\n    public $exportPath = 'some_path';\n\n    public $exportFilename = 'some_filename';\n\n    // ...\n}\n```\n\nYou can also use methods if you need more flexibility:\n\n```php\n\u003c?php\n\nnamespace App\\Mail;\n\nuse Illuminate\\Mail\\Mailable;\nuse PodPoint\\MailExport\\Concerns\\Exportable;\nuse PodPoint\\MailExport\\Contracts\\ShouldExport;\n\nclass OrderShipped extends Mailable implements ShouldExport\n{\n    use Exportable;\n\n    // ...\n\n    public function exportDisk(): string\n    {\n        return 'some_disk';\n    }\n\n    public function exportPath(): string\n    {\n        return 'some_path';\n    }\n\n    public function exportFilename(): string\n    {\n        return 'some_filename';\n    }\n}\n```\n\nThen you can keep using your `Mailable` as usual:\n\n```php\nMail::to($request-\u003euser())-\u003esend(new OrderShipped($order));\n```\n\nEven with Notifications too:\n\n```php\n\u003c?php\n\nnamespace App\\Notifications;\n\nuse App\\Mail\\OrderShipped as Mailable;\nuse Illuminate\\Notifications\\Notification;\n\nclass OrderShipped extends Notification\n{\n    // ...\n\n    public function toMail($notifiable)\n    {\n        return (new Mailable($this-\u003eorder))-\u003eto($notifiable-\u003eemail);\n    }\n}\n```\n\n## Testing\n\nRun the tests with:\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Credits\n\n- [themsaid](https://github.com/themsaid) and Spatie's [laravel-mail-preview](https://github.com/spatie/laravel-mail-preview) for some inspiration\n- [Laravel Package Development](https://laravelpackage.com) documentation by [John Braun](https://github.com/Jhnbrn90)\n- [Pod Point](https://github.com/pod-point)\n- [All Contributors](https://github.com/pod-point/laravel-mail-export/graphs/contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENCE.md) for more information.\n\n---\n\n\u003cimg src=\"https://d3h256n3bzippp.cloudfront.net/pod-point-logo.svg\" align=\"right\" /\u003e\n\nTravel shouldn't damage the earth 🌍\n\nMade with ❤️\u0026nbsp;\u0026nbsp;at [Pod Point](https://pod-point.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpod-point%2Flaravel-mail-export","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpod-point%2Flaravel-mail-export","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpod-point%2Flaravel-mail-export/lists"}