diff --git a/src/Mail/MailManager.php b/src/Mail/MailManager.php index ade48d425..45ee036d9 100644 --- a/src/Mail/MailManager.php +++ b/src/Mail/MailManager.php @@ -7,6 +7,7 @@ * Overrides the Laravel MailManager * - Replaces the Laravel Mailer class with the Winter Mailer class * - Fires mailer.beforeRegister & mailer.register events + * - Uses another method to determine old vs. new mail configs */ class MailManager extends BaseMailManager { @@ -71,4 +72,29 @@ protected function resolve($name) return $mailer; } + + /** + * @inheritDoc + */ + protected function getConfig(string $name) + { + // Here we will check if the "mailers" key exists and if it does, we will use that to + // determine the applicable config. Laravel checks if the "drivers" key exists, and while + // that does work for Laravel, it doesn't work in Winter when someone uses the Backend to + // populate mail settings, as these mail settings are populated into the "mailers" key. + return $this->app['config']['mail.mailers'] + ? ($this->app['config']["mail.mailers.{$name}"] ?? $this->app['config']['mail']) + : $this->app['config']['mail']; + } + + /** + * @inheritDoc + */ + public function getDefaultDriver() + { + // We will do the reverse of what Laravel does and check for "default" first, which is + // populated by the Backend or the new "mail" config, before searching for the "driver" + // key that was present in older version of Winter (<1.2). + return $this->app['config']['mail.default'] ?? $this->app['config']['mail.driver']; + } }