Swift_SmtpTransport::__construct PHP Method

__construct() public method

Create a new SmtpTransport, optionally with $host, $port and $security.
public __construct ( string $host = 'localhost', integer $port = 25, string $security = null )
$host string
$port integer
$security string
    public function __construct($host = 'localhost', $port = 25, $security = null)
    {
        call_user_func_array(array($this, 'Swift_Transport_EsmtpTransport::__construct'), Swift_DependencyContainer::getInstance()->createDependenciesFor('transport.smtp'));
        $this->setHost($host);
        $this->setPort($port);
        $this->setEncryption($security);
    }

Usage Example

Example #1
0
 public function __construct(array $config)
 {
     $host = Arr::get($config, 'host', 'localhost');
     $port = Arr::get($config, 'port', 25);
     $security = Arr::get($config, 'security', null);
     parent::__construct($host, $port, $security);
     if (isset($config['username'])) {
         $this->setUsername($config['username']);
     }
     if (isset($config['password'])) {
         $this->setPassword($config['password']);
     }
 }
All Usage Examples Of Swift_SmtpTransport::__construct
Swift_SmtpTransport