⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smtp.php

📁 太烦了
💻 PHP
📖 第 1 页 / 共 2 页
字号:
        $digest = &Auth_SASL::factory('digestmd5');        $auth_str = base64_encode($digest->getResponse($uid, $pwd, $challenge,                                                       $this->host, "smtp"));        if (PEAR::isError($error = $this->_put($auth_str))) {            return $error;        }        /* 334: Continue authentication request */        if (PEAR::isError($error = $this->_parseResponse(334))) {            return $error;        }        /* We don't use the protocol's third step because SMTP doesn't         * allow subsequent authentication, so we just silently ignore         * it. */        if (PEAR::isError($error = $this->_put(' '))) {            return $error;        }        /* 235: Authentication successful */        if (PEAR::isError($error = $this->_parseResponse(235))) {            return $error;        }    }    /**     * Authenticates the user using the CRAM-MD5 method.     *     * @param string The userid to authenticate as.     * @param string The password to authenticate with.     *     * @return mixed Returns a PEAR_Error with an error message on any     *               kind of failure, or true on success.     * @access private     * @since  1.1.0     */    function _authCRAM_MD5($uid, $pwd)    {        if (PEAR::isError($error = $this->_put('AUTH', 'CRAM-MD5'))) {            return $error;        }        /* 334: Continue authentication request */        if (PEAR::isError($error = $this->_parseResponse(334))) {            /* 503: Error: already authenticated */            if ($this->_code === 503) {                return true;            }            return $error;        }        $challenge = base64_decode($this->_arguments[0]);        $cram = &Auth_SASL::factory('crammd5');        $auth_str = base64_encode($cram->getResponse($uid, $pwd, $challenge));        if (PEAR::isError($error = $this->_put($auth_str))) {            return $error;        }        /* 235: Authentication successful */        if (PEAR::isError($error = $this->_parseResponse(235))) {            return $error;        }    }    /**     * Authenticates the user using the LOGIN method.     *     * @param string The userid to authenticate as.     * @param string The password to authenticate with.     *     * @return mixed Returns a PEAR_Error with an error message on any     *               kind of failure, or true on success.     * @access private     * @since  1.1.0     */    function _authLogin($uid, $pwd)    {        if (PEAR::isError($error = $this->_put('AUTH', 'LOGIN'))) {            return $error;        }        /* 334: Continue authentication request */        if (PEAR::isError($error = $this->_parseResponse(334))) {            /* 503: Error: already authenticated */            if ($this->_code === 503) {                return true;            }            return $error;        }        if (PEAR::isError($error = $this->_put(base64_encode($uid)))) {            return $error;        }        /* 334: Continue authentication request */        if (PEAR::isError($error = $this->_parseResponse(334))) {            return $error;        }        if (PEAR::isError($error = $this->_put(base64_encode($pwd)))) {            return $error;        }        /* 235: Authentication successful */        if (PEAR::isError($error = $this->_parseResponse(235))) {            return $error;        }        return true;    }    /**     * Authenticates the user using the PLAIN method.     *     * @param string The userid to authenticate as.     * @param string The password to authenticate with.     *     * @return mixed Returns a PEAR_Error with an error message on any     *               kind of failure, or true on success.     * @access private     * @since  1.1.0     */    function _authPlain($uid, $pwd)    {        if (PEAR::isError($error = $this->_put('AUTH', 'PLAIN'))) {            return $error;        }        /* 334: Continue authentication request */        if (PEAR::isError($error = $this->_parseResponse(334))) {            /* 503: Error: already authenticated */            if ($this->_code === 503) {                return true;            }            return $error;        }        $auth_str = base64_encode(chr(0) . $uid . chr(0) . $pwd);        if (PEAR::isError($error = $this->_put($auth_str))) {            return $error;        }        /* 235: Authentication successful */        if (PEAR::isError($error = $this->_parseResponse(235))) {            return $error;        }        return true;    }    /**     * Send the HELO command.     *     * @param string The domain name to say we are.     *     * @return mixed Returns a PEAR_Error with an error message on any     *               kind of failure, or true on success.     * @access public     * @since  1.0     */    function helo($domain)    {        if (PEAR::isError($error = $this->_put('HELO', $domain))) {            return $error;        }        if (PEAR::isError($error = $this->_parseResponse(250))) {            return $error;        }        return true;    }    /**     * Send the MAIL FROM: command.     *     * @param string The sender (reverse path) to set.     *     * @param array optional arguments. Currently supported:     *        verp   boolean or string. If true or string     *               verp is enabled. If string the characters     *               are considered verp separators.     *     * @return mixed Returns a PEAR_Error with an error message on any     *               kind of failure, or true on success.     * @access public     * @since  1.0     */    function mailFrom($sender, $args = array())    {        $argstr = '';        if (isset($args['verp'])) {            /* XVERP */            if ($args['verp'] === true) {                $argstr .= ' XVERP';            /* XVERP=something */            } elseif (trim($args['verp'])) {                $argstr .= ' XVERP=' . $args['verp'];            }        }        if (PEAR::isError($error = $this->_put('MAIL', "FROM:<$sender>$argstr"))) {            return $error;        }        if (PEAR::isError($error = $this->_parseResponse(250))) {            return $error;        }        return true;    }    /**     * Send the RCPT TO: command.     *     * @param string The recipient (forward path) to add.     *     * @return mixed Returns a PEAR_Error with an error message on any     *               kind of failure, or true on success.     * @access public     * @since  1.0     */    function rcptTo($recipient)    {        if (PEAR::isError($error = $this->_put('RCPT', "TO:<$recipient>"))) {            return $error;        }        if (PEAR::isError($error = $this->_parseResponse(array(250, 251)))) {            return $error;        }        return true;    }    /**     * Quote the data so that it meets SMTP standards.     *     * This is provided as a separate public function to facilitate     * easier overloading for the cases where it is desirable to     * customize the quoting behavior.     *     * @param string $data  The message text to quote. The string must be passed     *                      by reference, and the text will be modified in place.     *     * @access public     * @since  1.2     */    function quotedata(&$data)    {        /* Change Unix (\n) and Mac (\r) linefeeds into         * Internet-standard CRLF (\r\n) linefeeds. */        $data = preg_replace(array('/(?<!\r)\n/','/\r(?!\n)/'), "\r\n", $data);        /* Because a single leading period (.) signifies an end to the         * data, legitimate leading periods need to be "doubled"         * (e.g. '..'). */        $data = str_replace("\n.", "\n..", $data);    }    /**     * Send the DATA command.     *     * @param string $data  The message body to send.     *     * @return mixed Returns a PEAR_Error with an error message on any     *               kind of failure, or true on success.     * @access public     * @since  1.0     */    function data($data)    {        /* RFC 1870, section 3, subsection 3 states "a value of zero         * indicates that no fixed maximum message size is in force".         * Furthermore, it says that if "the parameter is omitted no         * information is conveyed about the server's fixed maximum         * message size". */        if (isset($this->_esmtp['SIZE']) && ($this->_esmtp['SIZE'] > 0)) {            if (strlen($data) >= $this->_esmtp['SIZE']) {                $this->disconnect();                return PEAR::raiseError('Message size excedes the server limit');            }        }        /* Quote the data based on the SMTP standards. */        $this->quotedata($data);        if (PEAR::isError($error = $this->_put('DATA'))) {            return $error;        }        if (PEAR::isError($error = $this->_parseResponse(354))) {            return $error;        }        if (PEAR::isError($result = $this->_send($data . "\r\n.\r\n"))) {            return $result;        }        if (PEAR::isError($error = $this->_parseResponse(250))) {            return $error;        }        return true;    }    /**     * Send the SEND FROM: command.     *     * @param string The reverse path to send.     *     * @return mixed Returns a PEAR_Error with an error message on any     *               kind of failure, or true on success.     * @access public     * @since  1.2.6     */    function sendFrom($path)    {        if (PEAR::isError($error = $this->_put('SEND', "FROM:<$path>"))) {            return $error;        }        if (PEAR::isError($error = $this->_parseResponse(250))) {            return $error;        }        return true;    }    /**     * Backwards-compatibility wrapper for sendFrom().     *     * @param string The reverse path to send.     *     * @return mixed Returns a PEAR_Error with an error message on any     *               kind of failure, or true on success.     *     * @access      public     * @since       1.0     * @deprecated  1.2.6     */    function send_from($path)    {        return sendFrom($path);    }    /**     * Send the SOML FROM: command.     *     * @param string The reverse path to send.     *     * @return mixed Returns a PEAR_Error with an error message on any     *               kind of failure, or true on success.     * @access public     * @since  1.2.6     */    function somlFrom($path)    {        if (PEAR::isError($error = $this->_put('SOML', "FROM:<$path>"))) {            return $error;        }        if (PEAR::isError($error = $this->_parseResponse(250))) {            return $error;        }        return true;    }    /**     * Backwards-compatibility wrapper for somlFrom().     *     * @param string The reverse path to send.     *     * @return mixed Returns a PEAR_Error with an error message on any     *               kind of failure, or true on success.     *     * @access      public     * @since       1.0     * @deprecated  1.2.6     */    function soml_from($path)    {        return somlFrom($path);    }    /**     * Send the SAML FROM: command.     *     * @param string The reverse path to send.     *     * @return mixed Returns a PEAR_Error with an error message on any     *               kind of failure, or true on success.     * @access public     * @since  1.2.6     */    function samlFrom($path)    {        if (PEAR::isError($error = $this->_put('SAML', "FROM:<$path>"))) {            return $error;        }        if (PEAR::isError($error = $this->_parseResponse(250))) {            return $error;        }        return true;    }    /**     * Backwards-compatibility wrapper for samlFrom().     *     * @param string The reverse path to send.     *     * @return mixed Returns a PEAR_Error with an error message on any     *               kind of failure, or true on success.     *     * @access      public     * @since       1.0     * @deprecated  1.2.6     */    function saml_from($path)    {        return samlFrom($path);    }    /**     * Send the RSET command.     *     * @return mixed Returns a PEAR_Error with an error message on any     *               kind of failure, or true on success.     * @access public     * @since  1.0     */    function rset()    {        if (PEAR::isError($error = $this->_put('RSET'))) {            return $error;        }        if (PEAR::isError($error = $this->_parseResponse(250))) {            return $error;        }        return true;    }    /**     * Send the VRFY command.     *     * @param string The string to verify     *     * @return mixed Returns a PEAR_Error with an error message on any     *               kind of failure, or true on success.     * @access public     * @since  1.0     */    function vrfy($string)    {        /* Note: 251 is also a valid response code */        if (PEAR::isError($error = $this->_put('VRFY', $string))) {            return $error;        }        if (PEAR::isError($error = $this->_parseResponse(array(250, 252)))) {            return $error;        }        return true;    }    /**     * Send the NOOP command.     *     * @return mixed Returns a PEAR_Error with an error message on any     *               kind of failure, or true on success.     * @access public     * @since  1.0     */    function noop()    {        if (PEAR::isError($error = $this->_put('NOOP'))) {            return $error;        }        if (PEAR::isError($error = $this->_parseResponse(250))) {            return $error;        }        return true;    }    /**     * Backwards-compatibility method.  identifySender()'s functionality is     * now handled internally.     *     * @return  boolean     This method always return true.     *     * @access  public     * @since   1.0     */    function identifySender()    {        return true;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -