日期:2013-04-16 浏览次数:20577 次
<?php
/**这个是改自pear中的解码类,增加了多种解码方式,修正了源码的系列bug.将解出的邮件分正文和附件存储,提高了解码效率。
* Mime decode class
*
* this class used at undecode Mime Files
* useage:
*
* $message=GetMessage($filename,$read_type,$read_size);
* $structure=RdMail($message);
* $from=$structure->headers['from'];
* $to=$structure->headers['to'];
*
* @copyright (c) 2004, richard,bjcctv. All rights reserved.
* @author richard,bjcctv
* @date:2004-11-24 last modified at:2005-06-01
* @package MimeDecode
* @version $Id$
*/
class Decode_Mimemail
{
/**
* Mime File
* @var string
*/
var $_input;
/**
* header string
* @var string
*/
var $_header;
/**
* body string
* @var string
*/
var $_body;
/**
* err info
* @var string
*/
var $_error;
/**
* whether include body object
* @var boolean
*/
var $_include_bodies;
/**
* whether include body object
* @var boolean
*/
var $_decode_bodies;
/**
* whether decode headers object
* @var boolean
*/
var $_decode_headers;
/**
* crlf variable
* @var string
*/
var $_crlf;
/**
* body parts
* @var object
*/
var $parts;
var $mid;
var $maildir;
/**
* Constructor.
*
* Sets up the object, initialise the variables, and splits and
* stores the header and body of the input.
*
* @param string The input to decode
* @access public
*/
function Decode_Mimemail($input, $mid, $maildir, $crlf = "\n")
{
$this->_crlf = "\n";
list($header, $body) = $this->splitBodyHeader($input); //拆分信头和信体两块