Phalcon\Mailer\Manager::registerTransportSmtp PHP Method

registerTransportSmtp() protected method

Create a new SmtpTransport instance.
See also: Swift_SmtpTransport
protected registerTransportSmtp ( ) : Swift_SmtpTransport
return Swift_SmtpTransport
    protected function registerTransportSmtp()
    {
        $config = $this->getConfig();
        /** @var $transport \Swift_SmtpTransport: */
        $transport = $this->getDI()->get('\\Swift_SmtpTransport')->setHost($config['host'])->setPort($config['port']);
        if (isset($config['encryption'])) {
            $transport->setEncryption($config['encryption']);
        }
        if (isset($config['username'])) {
            $transport->setUsername($this->normalizeEmail($config['username']));
            $transport->setPassword($config['password']);
        }
        return $transport;
    }