/** * Register the Mailer instance * * @return Mailer $mailer */ public function mailer() { // Once we have create the mailer instance, we will set a container instance // on the mailer. This allows us to resolve mailer classes via containers // for maximum testability on said classes instead of passing Closures. $mailer = new Mailer($this->di['mailer.view'], $this->di['swift.mailer']); $from = $this->_config['from']; if (is_array($from) && isset($from['address'])) { $mailer->alwaysFrom($from['address'], $from['name']); } return $mailer; }
/** * Set a few dependencies on the mailer instance. * * @param Mailer $mailer * * @return void */ protected function setMailerDependencies($mailer) { $mailer->setDI($this->di); if ($this->di->has('queue')) { $mailer->setQueue($this->di['queue']); } }