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

📄 class.smtp.php

📁 通达OA2007SE源代码 非常好的
💻 PHP
📖 第 1 页 / 共 2 页
字号:
        return false;
      }
      $extra = '';
      if (!empty ($keyword))
      {
        $extra = (' '.$keyword);
      }
      fputs ($this->smtp_conn, (('HELP'.$extra).$this->CRLF));
      $rply = $this->get_lines ();
      $code = substr ($rply, 0, 3);
      if ((2 <= $this->do_debug))
      {
        echo (('SMTP -> FROM SERVER:'.$this->CRLF).$rply);
      }
      if ((($code != 211) AND ($code != 214)))
      {
        $this->error = array ('error' => 'HELP not accepted from server', 'smtp_code' => $code, 'smtp_msg' => substr ($rply, 4));
        if ((1 <= $this->do_debug))
        {
          echo (((('SMTP -> ERROR: '.$this->error['error']).': ').$rply).$this->CRLF);
        }
        return false;
      }
      return $rply;
    }
    function mail ($from)
    {
      $this->error = null;
      if (!$this->connected ())
      {
        $this->error = array ('error' => 'Called Mail() without being connected');
        return false;
      }
      fputs ($this->smtp_conn, ((('MAIL FROM:<'.$from).'>').$this->CRLF));
      $rply = $this->get_lines ();
      $code = substr ($rply, 0, 3);
      if ((2 <= $this->do_debug))
      {
        echo (('SMTP -> FROM SERVER:'.$this->CRLF).$rply);
      }
      if (($code != 250))
      {
        $this->error = array ('error' => 'MAIL not accepted from server', 'smtp_code' => $code, 'smtp_msg' => substr ($rply, 4));
        if ((1 <= $this->do_debug))
        {
          echo (((('SMTP -> ERROR: '.$this->error['error']).': ').$rply).$this->CRLF);
        }
        return false;
      }
      return true;
    }
    function noop ()
    {
      $this->error = null;
      if (!$this->connected ())
      {
        $this->error = array ('error' => 'Called Noop() without being connected');
        return false;
      }
      fputs ($this->smtp_conn, ('NOOP'.$this->CRLF));
      $rply = $this->get_lines ();
      $code = substr ($rply, 0, 3);
      if ((2 <= $this->do_debug))
      {
        echo (('SMTP -> FROM SERVER:'.$this->CRLF).$rply);
      }
      if (($code != 250))
      {
        $this->error = array ('error' => 'NOOP not accepted from server', 'smtp_code' => $code, 'smtp_msg' => substr ($rply, 4));
        if ((1 <= $this->do_debug))
        {
          echo (((('SMTP -> ERROR: '.$this->error['error']).': ').$rply).$this->CRLF);
        }
        return false;
      }
      return true;
    }
    function quit ($close_on_error = true)
    {
      $this->error = null;
      if (!$this->connected ())
      {
        $this->error = array ('error' => 'Called Quit() without being connected');
        return false;
      }
      fputs ($this->smtp_conn, ('quit'.$this->CRLF));
      $byemsg = $this->get_lines ();
      if ((2 <= $this->do_debug))
      {
        echo (('SMTP -> FROM SERVER:'.$this->CRLF).$byemsg);
      }
      $rval = true;
      $e = null;
      $code = substr ($byemsg, 0, 3);
      if (($code != 221))
      {
        $e = array ('error' => 'SMTP server rejected quit command', 'smtp_code' => $code, 'smtp_rply' => substr ($byemsg, 4));
        $rval = false;
        if ((1 <= $this->do_debug))
        {
          echo (((('SMTP -> ERROR: '.$e['error']).': ').$byemsg).$this->CRLF);
        }
      }
      if ((empty ($e) OR $close_on_error))
      {
        $this->Close ();
      }
      return $rval;
    }
    function recipient ($to)
    {
      $this->error = null;
      if (!$this->connected ())
      {
        $this->error = array ('error' => 'Called Recipient() without being connected');
        return false;
      }
      fputs ($this->smtp_conn, ((('RCPT TO:<'.$to).'>').$this->CRLF));
      $rply = $this->get_lines ();
      $code = substr ($rply, 0, 3);
      if ((2 <= $this->do_debug))
      {
        echo (('SMTP -> FROM SERVER:'.$this->CRLF).$rply);
      }
      if ((($code != 250) AND ($code != 251)))
      {
        $this->error = array ('error' => 'RCPT not accepted from server', 'smtp_code' => $code, 'smtp_msg' => substr ($rply, 4));
        if ((1 <= $this->do_debug))
        {
          echo (((('SMTP -> ERROR: '.$this->error['error']).': ').$rply).$this->CRLF);
        }
        return false;
      }
      return true;
    }
    function reset ()
    {
      $this->error = null;
      if (!$this->connected ())
      {
        $this->error = array ('error' => 'Called Reset() without being connected');
        return false;
      }
      fputs ($this->smtp_conn, ('RSET'.$this->CRLF));
      $rply = $this->get_lines ();
      $code = substr ($rply, 0, 3);
      if ((2 <= $this->do_debug))
      {
        echo (('SMTP -> FROM SERVER:'.$this->CRLF).$rply);
      }
      if (($code != 250))
      {
        $this->error = array ('error' => 'RSET failed', 'smtp_code' => $code, 'smtp_msg' => substr ($rply, 4));
        if ((1 <= $this->do_debug))
        {
          echo (((('SMTP -> ERROR: '.$this->error['error']).': ').$rply).$this->CRLF);
        }
        return false;
      }
      return true;
    }
    function send ($from)
    {
      $this->error = null;
      if (!$this->connected ())
      {
        $this->error = array ('error' => 'Called Send() without being connected');
        return false;
      }
      fputs ($this->smtp_conn, (('SEND FROM:'.$from).$this->CRLF));
      $rply = $this->get_lines ();
      $code = substr ($rply, 0, 3);
      if ((2 <= $this->do_debug))
      {
        echo (('SMTP -> FROM SERVER:'.$this->CRLF).$rply);
      }
      if (($code != 250))
      {
        $this->error = array ('error' => 'SEND not accepted from server', 'smtp_code' => $code, 'smtp_msg' => substr ($rply, 4));
        if ((1 <= $this->do_debug))
        {
          echo (((('SMTP -> ERROR: '.$this->error['error']).': ').$rply).$this->CRLF);
        }
        return false;
      }
      return true;
    }
    function sendandmail ($from)
    {
      $this->error = null;
      if (!$this->connected ())
      {
        $this->error = array ('error' => 'Called SendAndMail() without being connected');
        return false;
      }
      fputs ($this->smtp_conn, (('SAML FROM:'.$from).$this->CRLF));
      $rply = $this->get_lines ();
      $code = substr ($rply, 0, 3);
      if ((2 <= $this->do_debug))
      {
        echo (('SMTP -> FROM SERVER:'.$this->CRLF).$rply);
      }
      if (($code != 250))
      {
        $this->error = array ('error' => 'SAML not accepted from server', 'smtp_code' => $code, 'smtp_msg' => substr ($rply, 4));
        if ((1 <= $this->do_debug))
        {
          echo (((('SMTP -> ERROR: '.$this->error['error']).': ').$rply).$this->CRLF);
        }
        return false;
      }
      return true;
    }
    function sendormail ($from)
    {
      $this->error = null;
      if (!$this->connected ())
      {
        $this->error = array ('error' => 'Called SendOrMail() without being connected');
        return false;
      }
      fputs ($this->smtp_conn, (('SOML FROM:'.$from).$this->CRLF));
      $rply = $this->get_lines ();
      $code = substr ($rply, 0, 3);
      if ((2 <= $this->do_debug))
      {
        echo (('SMTP -> FROM SERVER:'.$this->CRLF).$rply);
      }
      if (($code != 250))
      {
        $this->error = array ('error' => 'SOML not accepted from server', 'smtp_code' => $code, 'smtp_msg' => substr ($rply, 4));
        if ((1 <= $this->do_debug))
        {
          echo (((('SMTP -> ERROR: '.$this->error['error']).': ').$rply).$this->CRLF);
        }
        return false;
      }
      return true;
    }
    function turn ()
    {
      $this->error = array ('error' => 'This method, TURN, of the SMTP is not implemented');
      if ((1 <= $this->do_debug))
      {
        echo (('SMTP -> NOTICE: '.$this->error['error']).$this->CRLF);
      }
      return false;
    }
    function verify ($name)
    {
      $this->error = null;
      if (!$this->connected ())
      {
        $this->error = array ('error' => 'Called Verify() without being connected');
        return false;
      }
      fputs ($this->smtp_conn, (('VRFY '.$name).$this->CRLF));
      $rply = $this->get_lines ();
      $code = substr ($rply, 0, 3);
      if ((2 <= $this->do_debug))
      {
        echo (('SMTP -> FROM SERVER:'.$this->CRLF).$rply);
      }
      if ((($code != 250) AND ($code != 251)))
      {
        $this->error = array ('error' => (((''.'VRFY failed on name \'').$name).'\''), 'smtp_code' => $code, 'smtp_msg' => substr ($rply, 4));
        if ((1 <= $this->do_debug))
        {
          echo (((('SMTP -> ERROR: '.$this->error['error']).': ').$rply).$this->CRLF);
        }
        return false;
      }
      return $rply;
    }
    function get_lines ()
    {
      $data = '';
      while ($str = fgets ($this->smtp_conn, 515))
      {
        if ((4 <= $this->do_debug))
        {
          echo ((((''.'SMTP -> get_lines(): $data was "').$data).'"').$this->CRLF);
          echo ((((''.'SMTP -> get_lines(): $str is "').$str).'"').$this->CRLF);
        }
        ($data .= $str);
        if ((4 <= $this->do_debug))
        {
          echo ((((''.'SMTP -> get_lines(): $data is "').$data).'"').$this->CRLF);
        }
        if ((substr ($str, 3, 1) == ' '))
        {
          break;
        }
      }
      return $data;
    }
  }
?>

⌨️ 快捷键说明

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