Horde_Smtp::noop PHP Method

noop() public method

Send a NOOP command.
public noop ( )
    public function noop()
    {
        $this->login();
        // See RFC 5321 [4.1.1.9].
        // NOOP only useful if we are already authenticated.
        if (!is_null($this->_extensions)) {
            $this->_connection->write('NOOP');
            $this->_getResponse(250);
        }
    }

Usage Example

Example #1
0
File: Msa.php Project: horde/horde
 /**
  */
 public function valid(array $opts = array())
 {
     if (empty($opts['users']) || !isset($opts['auth'])) {
         unset($opts['auth']);
         $opts['users'] = array(null);
     }
     switch ($this->tls) {
         case 'starttls':
             $secure = 'tls';
             break;
         case 'tls':
             $secure = 'ssl';
             break;
         default:
             $secure = !empty($opts['insecure']) ?: 'tls';
             break;
     }
     foreach ($opts['users'] as $user) {
         try {
             $smtp = new Horde_Smtp(array('host' => $this->host, 'password' => isset($opts['auth']) ? $opts['auth'] : null, 'port' => $this->port, 'secure' => $secure, 'timeout' => 2, 'username' => $user));
             $smtp->noop();
             if (isset($opts['auth'])) {
                 $this->username = $user;
             }
             if ($secure === 'tls') {
                 $this->tls = 'starttls';
             } elseif ($secure === true) {
                 $this->tls = $pop3->isSecureConnection() ? 'starttls' : false;
             }
             $smtp->shutdown();
             return true;
         } catch (Horde_Smtp_Exception $e) {
         }
     }
     return false;
 }