25 #require_once 'Zend/Mime.php';    48         $body = str_replace(
"\r", 
'', $body);
    55         $p = strpos($body, 
'--' . $boundary . 
"\n", 
$start);
    62         $start = $p + 3 + strlen($boundary);
    64         while (($p = strpos($body, 
'--' . $boundary . 
"\n", 
$start)) !== 
false) {
    66             $start = $p + 3 + strlen($boundary);
    70         $p = strpos($body, 
'--' . $boundary . 
'--', 
$start);
    96         if (count($parts) <= 0) {
   100         foreach ($parts as $part) {
   103                 'header' => $headers,
   128         $firstline = strtok(
$message, 
"\n");
   129         if (!preg_match(
'%^[^\s]+[^:]*:%', $firstline)) {
   147         if (strpos(
$message, $EOL . $EOL)) {
   148             list($headers, $body) = explode($EOL . $EOL, 
$message, 2);
   151             if ($EOL != 
"\r\n" && strpos(
$message, 
"\r\n\r\n")) {
   152                 list($headers, $body) = explode(
"\r\n\r\n", 
$message, 2);
   155                 if ($EOL != 
"\n" && strpos(
$message, 
"\n\n")) {
   156                     list($headers, $body) = explode(
"\n\n", 
$message, 2);
   159                     @list($headers, $body) =
   160                         @preg_split(
"%([\r\n]+)\\1%U", 
$message, 2);
   165         $headers = iconv_mime_decode_headers(
   166             $headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR
   169         if ($headers === 
false) {
   175         foreach ($headers as 
$name => $header) {
   176             $lower = strtolower(
$name);
   177             if ($lower == 
$name) {
   180             unset($headers[
$name]);
   181             if (!isset($headers[$lower])) {
   182                 $headers[$lower] = $header;
   185             if (is_array($headers[$lower])) {
   186                 $headers[$lower][] = $header;
   189             $headers[$lower] = array(
   218         $field, $wantedPart = 
null, $firstName = 0
   221         $wantedPart = strtolower($wantedPart);
   222         $firstName  = strtolower($firstName);
   225         if ($firstName === $wantedPart) {
   226             $field = strtok($field, 
';');
   228             return $field[0] == 
'"' ? substr($field, 1, -1) : $field;
   231         $field = $firstName . 
'=' . $field;
   232         if (!preg_match_all(
'%([^=\s]+)\s*=\s*("[^"]+"|[^;]+)(;\s*|$)%', $field, $matches)) {
   237             foreach ($matches[1] as $key => 
$name) {
   238                 if (strcasecmp(
$name, $wantedPart)) {
   241                 if ($matches[2][$key][0] != 
'"') {
   242                     return $matches[2][$key];
   245                 return substr($matches[2][$key], 1, -1);
   252         foreach ($matches[1] as $key => 
$name) {
   254             if ($matches[2][$key][0] == 
'"') {
   255                 $split[
$name] = substr($matches[2][$key], 1, -1);
   257                 $split[
$name] = $matches[2][$key];
   274         return quoted_printable_decode($string);
 
static splitMessage( $message, &$headers, &$body, $EOL=Zend_Mime::LINEEND)
 
static splitMessageStruct( $message, $boundary, $EOL=Zend_Mime::LINEEND)
 
static splitMime($body, $boundary)
 
static splitHeaderField( $field, $wantedPart=null, $firstName=0)
 
static splitContentType($type, $wantedPart=null)
 
static decodeQuotedPrintable($string)
 
if(!isset($_GET['name'])) $name