On Wed, Sep 10, 2008 at 6:13 PM, Thomas Bruederli
<roundcube@gmail.com> wrote:
Plamen Hristov wrote:
> I'm currently trying to extract various message attachment types [doc,
> odt, pdf, etc] and convert them to plain text.I'm using the
> $IMAP->get_raw_body method to get the raw data and then send it to the
> appropriate converting program.Everything works fine except the fact
> that my converter does not recognize the file type.Seems like that
> $IMAP->get_raw_body is generating invalid content.
>
> Also 'file' returns RFC 822 mail text, instead of the standard ASCII
> mail text
Well, rcube_imap::get_raw_body() returns the complete message source
including all headers and is formatted according to RFC 822.
What you are looking for is a message structure after parsing the source:
$msg = new rcube_message($uid);
foreach ($msg->mime_parts as $mime_id => $part)
echo $msg->get_part_content($mime_id);
Note: you'll need the latest svn checkout to have all these classes available.
~Thomas
Thank you very much.However I found a workaround, currently using the munpack tool and everything is working fine.