Esempio n. 1
0
 /**
  * Disconnect from remote host and free resource
  */
 protected function _disconnect()
 {
     // @codingStandardsIgnoreEnd
     // Make sure the session gets closed
     $this->quit();
     parent::_disconnect();
 }
Esempio n. 2
0
 /**
  * Disconnect from remote host and free resource
  */
 protected function _disconnect()
 {
     // Make sure the session gets closed
     $this->quit();
     parent::_disconnect();
 }
Esempio n. 3
0
 /**
  * Constructor.
  *
  * The first argument may be an array of all options. If so, it must include
  * the 'host' and 'port' keys in order to ensure that all required values
  * are present.
  *
  * @param  string|array $host
  * @param  null|integer $port
  * @param  null|array   $config
  * @throws Exception\InvalidArgumentException
  */
 public function __construct($host = '127.0.0.1', $port = null, array $config = null)
 {
     // Did we receive a configuration array?
     if (is_array($host)) {
         // Merge config array with principal array, if provided
         if (is_array($config)) {
             $config = array_replace_recursive($host, $config);
         } else {
             $config = $host;
         }
         // Look for a host key; if none found, use default value
         if (isset($config['host'])) {
             $host = $config['host'];
         } else {
             $host = '127.0.0.1';
         }
         // Look for a port key; if none found, use default value
         if (isset($config['port'])) {
             $port = $config['port'];
         } else {
             $port = null;
         }
     }
     // If we don't have a config array, initialize it
     if (null === $config) {
         $config = array();
     }
     if (isset($config['ssl'])) {
         switch (strtolower($config['ssl'])) {
             case 'tls':
                 $this->secure = 'tls';
                 break;
             case 'ssl':
                 $this->transport = 'ssl';
                 $this->secure = 'ssl';
                 if ($port == null) {
                     $port = 465;
                 }
                 break;
             default:
                 throw new Exception\InvalidArgumentException($config['ssl'] . ' is unsupported SSL type');
                 break;
         }
     }
     // If no port has been specified then check the master PHP ini file. Defaults to 25 if the ini setting is null.
     if ($port == null) {
         if (($port = ini_get('smtp_port')) == '') {
             $port = 25;
         }
     }
     parent::__construct($host, $port);
 }