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

📄 class.phpmailer.php

📁 通达OA2007SE源代码 非常好的
💻 PHP
📖 第 1 页 / 共 3 页
字号:
      ($addr_str .= $this->LE);
      return $addr_str;
    }
    function addrformat ($addr)
    {
      if (empty ($addr[1]))
      {
        $formatted = $addr[0];
      }
      else
      {
        $formatted = ((($this->EncodeHeader ($addr[1], 'phrase').' <').$addr[0]).'>');
      }
      return $formatted;
    }
    function wraptext ($message, $length, $qp_mode = false)
    {
      $soft_break = ($qp_mode ? sprintf (' =%s', $this->LE) : $this->LE);
      $message = $this->FixEOL ($message);
      if ((substr ($message, -1) == $this->LE))
      {
        $message = substr ($message, 0, -1);
      }
      $line = explode ($this->LE, $message);
      $message = '';
      for ($i = 0; ($i < count ($line)); ++$i)
      {
        $line_part = explode (' ', $line[$i]);
        $buf = '';
        for ($e = 0; ($e < count ($line_part)); ++$e)
        {
          $word = $line_part[$e];
          if (($qp_mode AND ($length < strlen ($word))))
          {
            $space_left = (($length - strlen ($buf)) - 1);
            if (($e != 0))
            {
              if ((20 < $space_left))
              {
                $len = $space_left;
                if ((substr ($word, ($len - 1), 1) == '='))
                {
                  --$len;
                }
                else
                {
                  if ((substr ($word, ($len - 2), 1) == '='))
                  {
                    ($len -= 2);
                  }
                }
                $part = substr ($word, 0, $len);
                $word = substr ($word, $len);
                ($buf .= (' '.$part));
                ($message .= ($buf.sprintf ('=%s', $this->LE)));
              }
              else
              {
                ($message .= ($buf.$soft_break));
              }
              $buf = '';
            }
            while ((0 < strlen ($word)))
            {
              $len = $length;
              if ((substr ($word, ($len - 1), 1) == '='))
              {
                --$len;
              }
              else
              {
                if ((substr ($word, ($len - 2), 1) == '='))
                {
                  ($len -= 2);
                }
              }
              $part = substr ($word, 0, $len);
              $word = substr ($word, $len);
              if ((0 < strlen ($word)))
              {
                ($message .= ($part.sprintf ('=%s', $this->LE)));
                continue;
              }
              else
              {
                $buf = $part;
                continue;
              }
            }
            continue;
          }
          $buf_o = $buf;
          ($buf .= (($e == 0) ? $word : (' '.$word)));
          if ((($length < strlen ($buf)) AND ($buf_o != '')))
          {
            ($message .= ($buf_o.$soft_break));
            $buf = $word;
            continue;
          }
        }
        ($message .= ($buf.$this->LE));
      }
      return $message;
    }
    function setwordwrap ()
    {
      if (($this->WordWrap < 1))
      {
        return null;
      }
      switch ($this->message_type)
      {
        case 'alt':
        {
        }
        case 'alt_attachments':
        {
          $this->AltBody = $this->WrapText ($this->AltBody, $this->WordWrap);
          break;
        }
        default:
        {
          $this->Body = $this->WrapText ($this->Body, $this->WordWrap);
          break;
        }
      }
    }
    function createheader ()
    {
      $result = '';
      $uniq_id = md5 (uniqid (time ()));
      $this->boundary[1] = ('b1_'.$uniq_id);
      $this->boundary[2] = ('b2_'.$uniq_id);
      ($result .= $this->HeaderLine ('Date', $this->RFCDate ()));
      if (($this->Sender == ''))
      {
        ($result .= $this->HeaderLine ('Return-Path', trim ($this->From)));
      }
      else
      {
        ($result .= $this->HeaderLine ('Return-Path', trim ($this->Sender)));
      }
      if (($this->Mailer != 'mail'))
      {
        if ((0 < count ($this->to)))
        {
          ($result .= $this->AddrAppend ('To', $this->to));
        }
        else
        {
          if ((count ($this->cc) == 0))
          {
            ($result .= $this->HeaderLine ('To', 'undisclosed-recipients:;'));
          }
        }
        if ((0 < count ($this->cc)))
        {
          ($result .= $this->AddrAppend ('Cc', $this->cc));
        }
      }
      $from = array ();
      $from[0][0] = trim ($this->From);
      $from[0][1] = $this->FromName;
      ($result .= $this->AddrAppend ('From', $from));
      if (((($this->Mailer == 'sendmail') OR ($this->Mailer == 'mail')) AND (0 < count ($this->bcc))))
      {
        ($result .= $this->AddrAppend ('Bcc', $this->bcc));
      }
      if ((0 < count ($this->ReplyTo)))
      {
        ($result .= $this->AddrAppend ('Reply-to', $this->ReplyTo));
      }
      if (($this->Mailer != 'mail'))
      {
        ($result .= $this->HeaderLine ('Subject', $this->EncodeHeader (trim ($this->Subject))));
      }
      ($result .= sprintf ('Message-ID: <%s@%s>%s', $uniq_id, $this->ServerHostname (), $this->LE));
      ($result .= $this->HeaderLine ('X-Priority', $this->Priority));
      ($result .= $this->HeaderLine ('X-Mailer', (('PHPMailer [version '.$this->Version).']')));
      if (($this->ConfirmReadingTo != ''))
      {
        ($result .= $this->HeaderLine ('Disposition-Notification-To', (('<'.trim ($this->ConfirmReadingTo)).'>')));
      }
      for ($index = 0; ($index < count ($this->CustomHeader)); ++$index)
      {
        ($result .= $this->HeaderLine (trim ($this->CustomHeader[$index][0]), $this->EncodeHeader (trim ($this->CustomHeader[$index][1]))));
      }
      ($result .= $this->HeaderLine ('MIME-Version', '1.0'));
      switch ($this->message_type)
      {
        case 'plain':
        {
          ($result .= $this->HeaderLine ('Content-Transfer-Encoding', $this->Encoding));
          ($result .= sprintf ('Content-Type: %s; charset="%s"', $this->ContentType, $this->CharSet));
          break;
        }
        case 'attachments':
        {
        }
        case 'alt_attachments':
        {
          if ($this->InlineImageExists ())
          {
            ($result .= sprintf ('Content-Type: %s;%s	type="text/html";%s	boundary="%s"%s', 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE));
            break;
          }
          else
          {
            ($result .= $this->HeaderLine ('Content-Type', 'multipart/mixed;'));
            ($result .= $this->TextLine ((('	boundary="'.$this->boundary[1]).'"')));
            break;
          }
          break;
        }
        case 'alt':
        {
          ($result .= $this->HeaderLine ('Content-Type', 'multipart/alternative;'));
          ($result .= $this->TextLine ((('	boundary="'.$this->boundary[1]).'"')));
          break;
        }
      }
      if (($this->Mailer != 'mail'))
      {
        ($result .= ($this->LE.$this->LE));
      }
      return $result;
    }
    function createbody ()
    {
      $result = '';
      $this->SetWordWrap ();
      switch ($this->message_type)
      {
        case 'alt':
        {
          ($result .= $this->GetBoundary ($this->boundary[1], '', 'text/plain', ''));
          ($result .= $this->EncodeString ($this->AltBody, $this->Encoding));
          ($result .= ($this->LE.$this->LE));
          ($result .= $this->GetBoundary ($this->boundary[1], '', 'text/html', ''));
          ($result .= $this->EncodeString ($this->Body, $this->Encoding));
          ($result .= ($this->LE.$this->LE));
          ($result .= $this->EndBoundary ($this->boundary[1]));
          break;
        }
        case 'plain':
        {
          ($result .= $this->EncodeString ($this->Body, $this->Encoding));
          break;
        }
        case 'attachments':
        {
          ($result .= $this->GetBoundary ($this->boundary[1], '', '', ''));
          ($result .= $this->EncodeString ($this->Body, $this->Encoding));
          ($result .= $this->LE);
          ($result .= $this->AttachAll ());
          break;
        }
        case 'alt_attachments':
        {
          ($result .= sprintf ('--%s%s', $this->boundary[1], $this->LE));
          ($result .= sprintf ('Content-Type: %s;%s	boundary="%s"%s', 'multipart/alternative', $this->LE, $this->boundary[2], ($this->LE.$this->LE)));
          ($result .= ($this->GetBoundary ($this->boundary[2], '', 'text/plain', '').$this->LE));
          ($result .= $this->EncodeString ($this->AltBody, $this->Encoding));
          ($result .= ($this->LE.$this->LE));
          ($result .= ($this->GetBoundary ($this->boundary[2], '', 'text/html', '').$this->LE));
          ($result .= $this->EncodeString ($this->Body, $this->Encoding));
          ($result .= ($this->LE.$this->LE));
          ($result .= $this->EndBoundary ($this->boundary[2]));
          ($result .= $this->AttachAll ());
          break;
        }
      }
      if ($this->IsError ())
      {
        $result = '';
      }
      return $result;
    }
    function getboundary ($boundary, $charSet, $contentType, $encoding)
    {
      $result = '';
      if (($charSet == ''))
      {
        $charSet = $this->CharSet;
      }
      if (($contentType == ''))
      {
        $contentType = $this->ContentType;
      }
      if (($encoding == ''))
      {
        $encoding = $this->Encoding;
      }
      ($result .= $this->TextLine (('--'.$boundary)));
      ($result .= sprintf ('Content-Type: %s; charset = "%s"', $contentType, $charSet));
      ($result .= $this->LE);
      ($result .= $this->HeaderLine ('Content-Transfer-Encoding', $encoding));
      ($result .= $this->LE);
      return $result;
    }
    function endboundary ($boundary)
    {
      return (((($this->LE.'--').$boundary).'--').$this->LE);
    }
    function setmessagetype ()
    {
      if (((count ($this->attachment) < 1) AND (strlen ($this->AltBody) < 1)))
      {
        $this->message_type = 'plain';
      }
      else
      {
        if ((0 < count ($this->attachment)))
        {
          $this->message_type = 'attachments';
        }
        if (((0 < strlen ($this->AltBody)) AND (count ($this->attachment) < 1)))
        {
          $this->message_type = 'alt';
        }
        if (((0 < strlen ($this->AltBody)) AND (0 < count ($this->attachment))))
        {
          $this->message_type = 'alt_attachments';
        }
      }
    }
    function headerline ($name, $value)
    {
      return ((($name.': ').$value).$this->LE);
    }
    function textline ($value)
    {
      return ($value.$this->LE);
    }
    function addattachment ($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream')
    {
      if (!is_file ($path))
      {
        $this->SetError (($this->Lang ('file_access').$path));
        return false;
      }
      $filename = basename ($path);
      if (($name == ''))
      {
        $name = $filename;
      }
      $cur = count ($this->attachment);
      $this->attachment[$cur][0] = $path;
      $this->attachment[$cur][1] = $filename;
      $this->attachment[$cur][2] = $name;
      $this->attachment[$cur][3] = $encoding;
      $this->attachment[$cur][4] = $type;
      $this->attachment[$cur][5] = false;
      $this->attachment[$cur][6] = 'attachment';
      $this->attachment[$cur][7] = 0;
      return true;
    }
    function attachall ()
    {
      $mime = array ();
      for ($i = 0; ($i < count ($this->attachment)); ++$i)
      {
        $bString = $this->attachment[$i][5];
        if ($bString)
        {
          $string = $this->attachment[$i][0];
        }
        else

⌨️ 快捷键说明

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