[ class tree: Mail_Mime ] [ index: Mail_Mime ] [ all elements ]

Class: Mail_mimeDecode

Source Location: /Mail_mimeDecode-1.5.5/mimeDecode.php

Class Overview


The Mail_mimeDecode class is used to decode mail/mime messages



  • Release: @package_version@


  • 2003-2006 PEAR <>


Inherited Variables

Inherited Methods

Class Details

[line 91]
The Mail_mimeDecode class is used to decode mail/mime messages

This class will parse a raw mime email and return the structure. Returned structure is similar to that returned by imap_fetchstructure().

+----------------------------- IMPORTANT ------------------------------+ | Usage of this class compared to native php extensions such as | | mailparse or imap, is slow and may be feature deficient. If available| | you are STRONGLY recommended to use the php extensions. | +----------------------------------------------------------------------+

[ Top ]

Method Detail

Mail_mimeDecode (Constructor)   [line 168]

Mail_mimeDecode Mail_mimeDecode( string $input)


Sets up the object, initialise the variables, and splits and stores the header and body of the input.

  • Access: public


string   $input   —  The input to decode

[ Top ]

decode   [line 197]

object Decoded decode( [array $params = null])

Begins the decoding process. If called statically it will create an object and call the decode() method of it.
  • Return: results
  • Access: public


array   $params   —  An array of various parameters that determine various things: include_bodies - Whether to include the body in the returned object. decode_bodies - Whether to decode the bodies of the parts. (Transfer encoding) decode_headers - Whether to decode headers input - If called statically, this will be treated as the input

[ Top ]

getMimeNumbers   [line 374]

array &getMimeNumbers( &$structure, [ $no_refs = false], [string $mime_number = ''], [ $prepend = ''], object $structure)

Given the output of the above function, this will return an array of references to the parts, indexed by mime number.
  • Return: Mime numbers


object   $structure   —  The structure to go through
string   $mime_number   —  Internal use only.
   &$structure   — 
   $no_refs   — 
   $prepend   — 

[ Top ]

getSendArray   [line 861]

mixed getSendArray( )

getSendArray() returns the arguments required for Mail::send() used to build the arguments for a mail::send() call

Usage: $mailtext = Full email (for example generated by a template) $decoder = new Mail_mimeDecode($mailtext); $parts = $decoder->getSendArray(); if (!PEAR::isError($parts) { list($recipents,$headers,$body) = $parts; $mail = Mail::factory('smtp'); $mail->send($recipents,$headers,$body); } else { echo $parts->message; }

  • Return: array of recipeint, headers,body or Pear_Error
  • Author: Alan Knowles <>
  • Access: public

[ Top ]

getXML   [line 905]

string getXML( object Input $input)

Returns a xml copy of the output of Mail_mimeDecode::decode. Pass the output in as the argument. This function can be called statically. Eg:

$output = $obj->decode(); $xml = Mail_mimeDecode::getXML($output);

The DTD used for this should have been in the package. Or alternatively you can get it from cvs, or here:

  • Return: XML version of input
  • Access: public


object Input   $input   —  to convert to xml. This should be the output of the Mail_mimeDecode::decode function

[ Top ]

uudecode   [line 782]

array &uudecode( string $input)

Checks the input for uuencoded files and returns an array of them. Can be called statically, eg:

$files =& Mail_mimeDecode::uudecode($some_text);

It will check for the begin 666 ... end syntax however and won't just blindly decode whatever you pass it.

  • Return: Decoded bodies, filenames and permissions
  • Author: Unknown
  • Access: public


string   $input   —  Input body to look for attahcments in

[ Top ]

Documentation generated on Mon, 11 Mar 2019 15:41:47 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.