Implements the following SMTP-related RFCs:
  - RFC 1870/STD 10: Message Size Declaration
  - RFC 2034: Enhanced-Status-Codes
  - RFC 2195: CRAM-MD5 (SASL Authentication)
  - RFC 2595/4616: TLS & PLAIN (SASL Authentication)
  - RFC 2831: DIGEST-MD5 authentication mechanism (obsoleted by RFC 6331)
  - RFC 2920/STD 60: Pipelining
  - RFC 3207: Secure SMTP over TLS
  - RFC 3463: Enhanced Mail System Status Codes
  - RFC 4422: SASL Authentication (for DIGEST-MD5)
  - RFC 4954: Authentication
  - RFC 5321: Simple Mail Transfer Protocol
  - RFC 6152/STD 71: 8bit-MIMEtransport
  - RFC 6409/STD 72: Message Submission for Mail
  - RFC 6531: Internationalized Email

  - XOAUTH2: https://developers.google.com/gmail/xoauth2_protocol
TODO:
  - RFC 1845: CHECKPOINT
  - RFC 2852: DELIVERYBY
  - RFC 3030: BINARYMIME/CHUNKING
  - RFC 3461: DSN
  - RFC 3865: NO-SOLICITING
  - RFC 3885: MTRK
  - RFC 4141: CONPERM/CONNEG
  - RFC 4405: SUBMITTER
  - RFC 4468: BURL
  - RFC 4865: FUTURERELEASE
  - RFC 6710: MT-PRIORITY
  - RFC 7293: RRVS
Author: Michael Slusarz (slusarz@horde.org)
Inheritance: implements Serializable
Exemple #1
0
 /**
  */
 public function __construct(array $params = array())
 {
     // LMTP MUST NOT be on port 25 (RFC 2033 [5]).
     if (isset($params['port']) && $params['port'] == 25) {
         throw new InvalidArgumentException('Cannot use port 25 for a LMTP server.');
     }
     parent::__construct($params);
 }
Exemple #2
0
 /**
  * Connect to the SMTP server by instantiating a Horde_Smtp object.
  *
  * @return Horde_Smtp  The SMTP object.
  * @throws Horde_Mail_Exception
  */
 public function getSMTPObject()
 {
     if (!$this->_smtp) {
         $this->_smtp = new Horde_Smtp($this->_params);
         try {
             $this->_smtp->login();
         } catch (Horde_Smtp_Exception $e) {
             throw new Horde_Mail_Exception($e);
         }
     }
     return $this->_smtp;
 }
Exemple #3
0
 /**
  */
 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;
 }