/** * 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; }