Skip to content

Commit

Permalink
Add instructions and example how to use custom configs
Browse files Browse the repository at this point in the history
  • Loading branch information
iwasherefirst2 committed Oct 25, 2020
1 parent a994919 commit 4ce0675
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This package works for `SMTP` and `log` drivers.
- [Bulk messages](#bulk-messages)
- [Default mailaccount](#default-mailaccount)
- [Testing](#testing)
- [Get Mail From Database](#get-mail-from-database)

## Requirements

Expand Down Expand Up @@ -218,3 +219,32 @@ To avoid latency, I recommend to always use the `log` mail driver when `phpunit`

If you want to use the mocking feature [Mail fake](https://laravel.com/docs/mocking#mail-fake) during your tests, enable `use_default_mail_facade_in_tests`
in your config file `config/multimail.php`. Note that `assertQueued` will never be true, because `queued` mails are actually send through `sent` through a job.

### Get Mail From Database

If you want to load your mail account configuration from database
or anything else, just create a class that implements `\IWasHereFirst2\LaravelMultiMail\MailSettings`
and specify the class in `config/multimail.php` under the key `mail_settings_class`.

For example:

<?php

return [
/*
|--------------------------------------------------------------------------
| List your email providers
|--------------------------------------------------------------------------
|
| Enjoy a life with multimail
|
*/
'use_default_mail_facade_in_tests' => true,

'mail_settings_class' => \App\MyCustomMailSettings::class,

];

Notice that you do not need to specify `email` or `provider` in the config anymore.
They should be loaded by your custom class `\App\MyCustomMailSettings::class`.

0 comments on commit 4ce0675

Please sign in to comment.