protected function __new__($login, $password) { $this->login = $login; $this->password = $password; parent::__new__(); $this->from($login); $this->resource = fsockopen('tls://smtp.gmail.com', 465, $errno, $errstr, 30); if ($this->resource === false) { throw new \Exception('connect fail'); } }