All Projects → Pod-Point → laravel-mail-export

Pod-Point / laravel-mail-export

Licence: MIT license
A simple mailable trait and interface to export mails to a storage disk once being sent.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to laravel-mail-export

Imapbackup
A Python script for incremental backups of IMAP mailboxes
Stars: ✭ 156 (+90.24%)
Mutual labels:  backup, mail
kirby-backup-widget
Kirby panel widget to easily backup your site content.
Stars: ✭ 25 (-69.51%)
Mutual labels:  backup, archive
blockyarchive
Blocky archive - multithreaded archiver offering bit rot protection and sector level recoverability
Stars: ✭ 88 (+7.32%)
Mutual labels:  backup, archive
Dmarchiver
A tool to archive the direct messages, images and videos from your private conversations on Twitter
Stars: ✭ 204 (+148.78%)
Mutual labels:  backup, archive
dedupsqlfs
Deduplicating filesystem via Python3, FUSE and SQLite
Stars: ✭ 24 (-70.73%)
Mutual labels:  backup
b2-sdk-php
SDK for Backblaze's B2 storage service.
Stars: ✭ 75 (-8.54%)
Mutual labels:  backup
ZRA
ZStandard Random Access (ZRA) allows random access inside an archive compressed using ZStandard
Stars: ✭ 21 (-74.39%)
Mutual labels:  archive
enough mail
IMAP, POP3 and SMTP clients for Dart developers. Contains both low level as well as a high level API.
Stars: ✭ 78 (-4.88%)
Mutual labels:  mail
grafana-backup
[ON HOLD] CLI tool for backup/restore Grafana dashboards and datasources.
Stars: ✭ 28 (-65.85%)
Mutual labels:  backup
backup-repository
Backup storage for E2E GPG-encrypted files, with multi-user, quotas, versioning, using a object storage (S3/Min.io/GCS etc.) and deployed on Kubernetes or standalone.
Stars: ✭ 21 (-74.39%)
Mutual labels:  backup
extract-xiso
Xbox ISO Creation/Extraction utility. Imported from SourceForge.
Stars: ✭ 358 (+336.59%)
Mutual labels:  backup
yii2-symfonymailer
Yii 2 Symfony mailer extension.
Stars: ✭ 29 (-64.63%)
Mutual labels:  mail
go-dkim
A Go library to create and verify DKIM signatures (migrated)
Stars: ✭ 38 (-53.66%)
Mutual labels:  mail
trello-full-backup
Python script to backup everything from Trello: boards, lists, cards and attachments
Stars: ✭ 119 (+45.12%)
Mutual labels:  backup
mindav
A self-hosted file backup server which bridges WebDAV protocol with @minio written in @totoval. Webdav ❤️ Minio
Stars: ✭ 64 (-21.95%)
Mutual labels:  backup
SplitShare
Shamir's Secret Sharing Algorithm implementation in golang combined with PGP and a mail delivery system
Stars: ✭ 31 (-62.2%)
Mutual labels:  mail
jira-backup-py
python script to create, download and upload to s3 your Jira or Confluence cloud instance backup
Stars: ✭ 36 (-56.1%)
Mutual labels:  backup
robot-email-template
Email template for Robot Framework test results
Stars: ✭ 19 (-76.83%)
Mutual labels:  mail
goodrexport
Goodreads data export
Stars: ✭ 16 (-80.49%)
Mutual labels:  backup
underbase
MongoDB schema and data migration library based on semver
Stars: ✭ 19 (-76.83%)
Mutual labels:  backup

Laravel Mail Export

Latest Version on Packagist GitHub Workflow Status Software License Total Downloads

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

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

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 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

namespace App\Mail;

use Illuminate\Mail\Mailable;
use PodPoint\MailExport\Concerns\Exportable;
use PodPoint\MailExport\Contracts\ShouldExport;

class OrderShipped extends Mailable implements ShouldExport
{
    use Exportable;

    // ...
}

This will use the default filesystem disk and path from the configuration and will also generate a unique filename for you.

The default filename is using a timestamp, the mail recipients, the subject and will look like so:

2021_03_26_150142_jane_at_example_com_this_is_the_subject.eml

You can also specify the disk, path or filename to use for a specific Mailable using properties:

<?php

namespace App\Mail;

use Illuminate\Mail\Mailable;
use PodPoint\MailExport\Concerns\Exportable;
use PodPoint\MailExport\Contracts\ShouldExport;

class OrderShipped extends Mailable implements ShouldExport
{
    use Exportable;

    public $exportDisk = 'some_disk';

    public $exportPath = 'some_path';

    public $exportFilename = 'some_filename';

    // ...
}

You can also use methods if you need more flexibility:

<?php

namespace App\Mail;

use Illuminate\Mail\Mailable;
use PodPoint\MailExport\Concerns\Exportable;
use PodPoint\MailExport\Contracts\ShouldExport;

class OrderShipped extends Mailable implements ShouldExport
{
    use Exportable;

    // ...

    public function exportDisk(): string
    {
        return 'some_disk';
    }

    public function exportPath(): string
    {
        return 'some_path';
    }

    public function exportFilename(): string
    {
        return 'some_filename';
    }
}

Then you can keep using your Mailable as usual:

Mail::to($request->user())->send(new OrderShipped($order));

Even with Notifications too:

<?php

namespace App\Notifications;

use App\Mail\OrderShipped as Mailable;
use Illuminate\Notifications\Notification;

class OrderShipped extends Notification
{
    // ...

    public function toMail($notifiable)
    {
        return (new Mailable($this->order))->to($notifiable->email);
    }
}

Testing

Run the tests with:

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.


Travel shouldn't damage the earth 🌍

Made with ❤️  at Pod Point

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].