From 5e4b2c5305d3255d7f5487b8f5864fd5d50db6d6 Mon Sep 17 00:00:00 2001 From: Mohamed Said Date: Fri, 16 Feb 2018 09:32:53 +0200 Subject: [PATCH] only register id domain if a value was set --- src/Illuminate/Mail/MailServiceProvider.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Mail/MailServiceProvider.php b/src/Illuminate/Mail/MailServiceProvider.php index d594f58288d1..c134eac737f6 100755 --- a/src/Illuminate/Mail/MailServiceProvider.php +++ b/src/Illuminate/Mail/MailServiceProvider.php @@ -89,14 +89,16 @@ public function registerSwiftMailer() { $this->registerSwiftTransport(); - Swift_DependencyContainer::getInstance() - ->register('mime.idgenerator.idright') - ->asValue($this->app->make('config')->get('mail.domain', 'swift.generated')); - // Once we have the transporter registered, we will register the actual Swift // mailer instance, passing in the transport instances, which allows us to // override this transporter instances during app start-up if necessary. $this->app->singleton('swift.mailer', function ($app) { + if ($mailDomain = $app->make('config')->get('mail.domain')) { + Swift_DependencyContainer::getInstance() + ->register('mime.idgenerator.idright') + ->asValue($mailDomain); + } + return new Swift_Mailer($app['swift.transport']->driver()); }); }