in reply to Re: mail attachment extraction
in thread mail attachment extraction

Thank you for your nice corrections. I now can figure out where the problem precisely is. Imap:Talk through its fetch() method returns a structure. But Email::Mime is waiting for a string... I am trying now to find a way... I have tried a method parse_mode(ParseOption => $ParseMode) given by Imap::Talk, but without success for now... Or maybe should I use a different module ?

Replies are listed 'Best First'.
Re^3: mail attachment extraction
by Krambambuli (Curate) on May 03, 2007 at 20:57 UTC
    I guess you don't really need Email::MIME explicitely.

    Once you got the message you want in $MsgTxt, just do
    my $stripper = Email::MIME::Attachment::Stripper->new( $MsgTxt); my @attachments = $stripper->attachments;
    and you should have what you want.
      Sorry but I am still trying and can't get to anywhere... I definitely can't give $MsgTxt to Attachment::stripper, because it needs an Email::Mime object. The parsing does not go well with Email::Mime : it is all messed up. Somehow I can't get IMAP::Talk to give me something in the proper format, but this is beyond my understanding... I am really exhausted, I have been 2 weeks on that :(
        I'm not sure what exactly it is what you're stumbling over.

        I have tested the code I've submitted and it works quite well.

        Just instantiate Email::MIME::Attachment::Stripper using the full text mail, as I mentioned previously and it just works as expected. Did you try it ?

        Outcomment all code you have in your original program between the assignment to $MsgTxt and the instantiation of the stripper.

        I'll add the full code if you think it's necessary, but there is really nothing else there than getting rid of the superfluous codelines.