Mail_mimeDecode

Mail_mimeDecode -- work with MIME messages

Description

Mail_mimeDecode provides functions to process MIME message. It will take the input you give it and decode it into a usable PHP data structure.

Mail_mimeDecode::Mail_mimeDecode()

Mail_mimeDecode Mail_mimeDecode (string $input [, string $crlf = "\r\n"])

Description

Returns a new instance of Mail_mimeDecode

Parameter

Mail_mime::decode()

array decode (array $args)

Description

This function performs the decoding and returns a structure containing the message data.

Parameter

Return value

Mail_mime::uudecode()

array uudecode (string $input)

Description

uudecode() looks for UU-encoded parts in the given message. UU stands for the Unix-to-Unix protocol. Actually this is a common used protocoll for transfering files using the 7-bit-ASCII character set over the internet.

Parameter

Return value

Note

uudecode() can be called as static function.

Mail_mime::getXML()

string getXML (array $decoded)

Description

getXML() converts the returned array from decode () into a valid XML document. The DTD for this document is avaible from the Mail_MimeDecode-Package or http://www.phpguru.org/xmail/ .

Parameter

Return value

Note

getXML() can be called as static function.

Example

<?php

include 'Mail/mimeDecode.php';

...

$params['include_bodies'] = TRUE;
$params['decode_bodies']  = TRUE;
$params['decode_headers'] = TRUE;

$decoder = new Mail_mimeDecode($input);
$structure = $decoder->decode($params);

?>

This example calls the decode function statically (ie no object, straight function call) and then passes the structure to the getXML() function.

<?php

...

$params['include_bodies'] = TRUE;
$params['decode_bodies']  = FALSE;
$params['decode_headers'] = TRUE;
$params['input']          = $input;
$params['crlf']           = "\r\n";

$structure = Mail_mimeDecode::decode($params);
$xml = Mail_mimeDecode::getXML($structure);

?>