public function extendTransportManager(TransportManager $manager) { $manager->extend('sendgrid', function () { $config = $this->app['config']->get('services.sendgrid', array()); $client = new HttpClient(Arr::get($config, 'guzzle', [])); if (Arr::get($config, 'version') === 'v3') { return new SendgridV3Transport($client, $config['api_key']); } return new SendgridTransport($client, $config['api_key']); }); }
public function newMailer() { $config = $this->getConfig(); $transportManager = new TransportManager($this->app); $transport = $transportManager->driver($config['mail']['driver']); $swiftMailer = new \Swift_Mailer($transport); return new LaravelMailer($this->viewFactory, $swiftMailer); }