Merge pull request #6053 from turbo124/v5-develop

Fixes for mail providers
This commit is contained in:
David Bomba 2021-06-17 12:58:01 +10:00 committed by GitHub
commit 969a2946e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 10 deletions

View File

@ -33,9 +33,9 @@ class MailCssInlinerServiceProvider extends ServiceProvider
return new CssInlinerPlugin([]); return new CssInlinerPlugin([]);
}); });
$this->app->afterResolving('mail.manager', function (MailManager $mailManager) { // $this->app->afterResolving('mail.manager', function (MailManager $mailManager) {
$mailManager->getSwiftMailer()->registerPlugin($this->app->make(CssInlinerPlugin::class)); // $mailManager->getSwiftMailer()->registerPlugin($this->app->make(CssInlinerPlugin::class));
return $mailManager; // return $mailManager;
}); // });
} }
} }

View File

@ -3,10 +3,11 @@
namespace App\Providers; namespace App\Providers;
use App\Helpers\Mail\GmailTransportManager; use App\Helpers\Mail\GmailTransportManager;
use App\Utils\CssInlinerPlugin;
use Coconuts\Mail\PostmarkTransport; use Coconuts\Mail\PostmarkTransport;
use GuzzleHttp\Client as HttpClient;
use Illuminate\Mail\MailServiceProvider as MailProvider; use Illuminate\Mail\MailServiceProvider as MailProvider;
use Illuminate\Mail\TransportManager; use Illuminate\Mail\TransportManager;
use GuzzleHttp\Client as HttpClient;
class MailServiceProvider extends MailProvider class MailServiceProvider extends MailProvider
{ {
@ -27,10 +28,6 @@ class MailServiceProvider extends MailProvider
return new GmailTransportManager($app); return new GmailTransportManager($app);
}); });
// $this->app->bind('mail.manager', function($app) {
// return new GmailTransportManager($app);
// });
$this->app->bind('mailer', function ($app) { $this->app->bind('mailer', function ($app) {
return $app->make('mail.manager')->mailer(); return $app->make('mail.manager')->mailer();
}); });
@ -42,6 +39,10 @@ class MailServiceProvider extends MailProvider
); );
}); });
$this->app->afterResolving('mail.manager', function (GmailTransportManager $mailManager) {
$mailManager->getSwiftMailer()->registerPlugin($this->app->make(CssInlinerPlugin::class));
return $mailManager;
});
} }
protected function guzzle(array $config): HttpClient protected function guzzle(array $config): HttpClient
@ -57,6 +58,7 @@ class MailServiceProvider extends MailProvider
{ {
return [ return [
'mail.manager', 'mail.manager',
'mailer' ]; 'mailer'
];
} }
} }