This package extends beyondcode/laravel-mail by providing a simple syntax to register mail handlers in a routes file which is outside of a service provider.
You can install the package via composer:
composer require elegasoft/mailbox-routerFirst publish the route file stub to routes/mail.php:
php artisan mailboxes:install(Optional) generate a mailbox to handle a route (i.e. App\Mailboxes\MyMailbox):
php artisan make:mailbox MyMailboxThen define mailboxes to handle incoming mail:
// routes/mail.php
return [
/*
* Map emails sent from a specific address to a class which
* will be invoked to process the incoming email message.
*
* For example: '[email protected]' => ExampleMailbox::class
*/
'from' => [
'[email protected]' => MyMailbox::class,
'[email protected]' => MyMailbox::class,
],
/*
* Map emails sent to a specific address to a class which
* will be invoked to process the incoming email message.
*
* For example: '[email protected]' => ExampleMailbox::class
*/
'to' => [],
/*
* Map emails cc'd to a specific address to a class which
* will be invoked to process the incoming email message.
*
* For example: '[email protected]' => ExampleMailbox::class
*/
'cc' => [],
/*
* Map emails containing a specific subject to a class which
* will be invoked to process the incoming email message.
*
* For example: 'This Subject' => ExampleMailbox::class
*/
'subject' => [],
/*
* Only when an email does not match any of the preceding
* invoke this class to catch the email for processing.
*
* For example: ExampleFallbackMailbox::class,
*/
'fallback' => ExampleFallbackMailbox::class,
/*
* Regardless of when an email matches any of the preceding
* always invoke this class to process the email message.
*
* For example: ExampleCatchAllMailbox::class,
*/
'catchAll' => ExampleCatchAllMailbox::class,
];The MailboxRouterServiceProvider::class will automatically bind each of the mail routes and invoke the classes or
callbacks which when required to process an email which matches the registration.
You cannot use Regular Expression Contraints as define in the
beyondcode/laravel-mailbox docs.
composer testPlease see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package was generated using the Laravel Package Boilerplate.