PEAR Manual
Prev |  | Next

# Mail_mimeDecode - Example

Mail_mimeDecode - Example -- decode an email

## Example

Example 46-1. Decode an email
    <?php
    require_once '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);

    ?>

Prev | Home | Next
Mail_mimeDecode::getXML() | Up | Mail_Queue