From 4ce06753d12e775a97741bb2e0beeb0acfe2135b Mon Sep 17 00:00:00 2001 From: Adam Nielsen <1765602+iwasherefirst2@users.noreply.github.com> Date: Sun, 25 Oct 2020 14:51:15 +0100 Subject: [PATCH] Add instructions and example how to use custom configs --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index abe679a..dc21c28 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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: + + 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`. +