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

Class: Mail_mimeDecode

Source Location: /modules/Apps/MailClient/PEAR/Mail/mimeDecode.php

Class Mail_mimeDecode

Class Overview

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. | +----------------------------------------------------------------------+

Located in /modules/Apps/MailClient/PEAR/Mail/mimeDecode.php [line 91]

PEAR
   |
   --Mail_mimeDecode
Author(s): Information Tags:
Version:  Release: @package_version@
Copyright:  2003-2006 PEAR <pear-group@php.net>
Link:  http://pear.php.net/package/Mail_mime
License:  BSD License

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From PEAR

PEAR::PEAR()
Constructor. Registers this object in $_PEAR_destructor_object_list for destructor emulation if a destructor object exists.
PEAR::delExpect()
This method deletes all occurences of the specified element from the expected error codes stack.
PEAR::expectError()
This method is used to tell which errors you expect to get.
PEAR::getStaticProperty()
If you have a class that's mostly/entirely static, and you need static
PEAR::isError()
Tell whether a value is a PEAR error.
PEAR::loadExtension()
OS independant PHP extension load. Remember to take care on the correct extension name for case sensitive OSes.
PEAR::popErrorHandling()
Pop the last error handler used
PEAR::popExpect()
This method pops one element off the expected error codes stack.
PEAR::pushErrorHandling()
Push a new error handler on top of the error handler options stack. With this you can easily override the actual error handler for some code and restore it later with popErrorHandling.
PEAR::raiseError()
This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. If the $mode and $options parameters are not specified, the object's defaults are used.
PEAR::registerShutdownFunc()
Use this function to register a shutdown method for static classes.
PEAR::setErrorHandling()
Sets how errors generated by this object should be handled.
PEAR::staticPopErrorHandling()
PEAR::staticPushErrorHandling()
PEAR::throwError()
Simpler form of raiseError with fewer options. In most cases message, code and userinfo are enough.
PEAR::_PEAR()
Destructor (the emulated type of...). Does nothing right now, but is included for forward compatibility, so subclass destructors should always call it.

[ Top ]
Method Summary
Mail_mimeDecode   Mail_mimeDecode()   Constructor.
object Decoded   decode()   Begins the decoding process. If called statically it will create an object and call the decode() method of it.
array   &getMimeNumbers()   Given the output of the above function, this will return an array of references to the parts, indexed by mime number.
mixed   getSendArray()   getSendArray() returns the arguments required for Mail::send() used to build the arguments for a mail::send() call
string   getXML()   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:
array   &uudecode()   Checks the input for uuencoded files and returns an array of them. Can be called statically, eg:

[ Top ]
Methods
Constructor Mail_mimeDecode  [line 159]

  Mail_mimeDecode Mail_mimeDecode( string $input  )

Constructor.

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

Parameters:
string   $input:  The input to decode

API Tags:
Access:  public


[ Top ]
decode  [line 187]

  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.

Parameters:
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

API Tags:
Return:  results
Access:  public


[ Top ]
getMimeNumbers  [line 356]

  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.

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

API Tags:
Return:  Mime numbers


[ Top ]
getSendArray  [line 707]

  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; }


API Tags:
Return:  array of recipeint, headers,body or Pear_Error
Access:  public

Information Tags:
Author:  Alan Knowles <alan@akbkhome.com>

[ Top ]
getXML  [line 751]

  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: http://www.phpguru.org/xmail/xmail.dtd.

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

API Tags:
Return:  XML version of input
Access:  public


[ Top ]
uudecode  [line 628]

  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.

Parameters:
string   $input:  Input body to look for attahcments in

API Tags:
Return:  Decoded bodies, filenames and permissions
Access:  public

Information Tags:
Author:  Unknown

[ Top ]

Documentation generated on Fri, 26 Dec 2008 21:43:59 -0500 by phpDocumentor 1.4.2