Swift_MailTransport::newInstance PHP Method

newInstance() public static method

Create a new MailTransport instance.
public static newInstance ( string $extraParams = '-f%s' ) : Swift_MailTransport
$extraParams string To be passed to mail()
return Swift_MailTransport
    public static function newInstance($extraParams = '-f%s')
    {
        return new self($extraParams);
    }

Usage Example

Beispiel #1
0
 public function getTransport()
 {
     // Get Joomla mailer
     $config = JFactory::getConfig();
     $jmailer = $config->get('mailer');
     switch ($jmailer) {
         case 'sendmail':
             $this->transport = Swift_SendmailTransport::newInstance($config->get('sendmail') . ' -bs');
             break;
         case 'smtp':
             $this->transport = Swift_SmtpTransport::newInstance($config->get('smtphost'), $config->get('smtpport'));
             if ($config->get('smtpauth') == 1) {
                 $smtpUser = $config->get('smtpuser');
                 $smtpPass = $config->get('smtppass');
                 if (!empty($smtpUser) && !empty($smtpPass)) {
                     $this->transport->setUsername($smtpUser)->setPassword($smtpPass);
                 }
                 $smtpEncryption = $config->get('smtpsecure');
                 if (!empty($smtpEncryption)) {
                     $this->transport->setEncryption($smtpEncryption);
                 }
             }
             break;
         default:
         case 'mail':
             $this->transport = Swift_MailTransport::newInstance();
             break;
     }
 }
All Usage Examples Of Swift_MailTransport::newInstance
Swift_MailTransport