[dev] MIME handling

Stuart Bingë omicron-list at mighty.co.za
Tue Sep 21 08:56:54 PDT 2004


Hi guys,

Just a question about what the proper way to handle MIME messages using the 
Horde MIME libraries is.

Here's the problem I'm facing: I've got a text representation of an email 
message, and need to get a (properly decoded) text representation of a 
particular MIME part (that has a specific MIME type). Here's a paraphrased 
version of how I'm currently doing it:

$mime_message = &MIME_Structure::parseTextMIMEMessage($text_message);

$mime_parts = $mime_message->contentTypeMap();
foreach ($mime_parts as $mime_id => $content_type) {
    if ($content_type == $desired_content_type) {
        $mime_part = $mime_message->getPart($mime_id);
        $desired_text = $mime_part->transferDecode();
        break;
    }
}

Is this correct, or should I be using some other functions? I'm most concerned 
about the transferDecode() function, and whether it's the correct way to 
decode the mime part (most parts I'm dealing with are quoted-printable 
encoded).

Cheers,
Stuart


More information about the dev mailing list