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

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.

Replies are listed 'Best First'.
Re^4: mail attachment extraction
by phocean (Novice) on May 06, 2007 at 16:08 UTC
    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.

        Really ! So something must be wrong with me... Using Attachment::Stripper directly fails on : "Need a message"... I updated the code on this page, as you can see I followed your recommandation. Of course, I tried "$stripper = Email::MIME::Attachment::Stripper->new($MsgTxt);" many times.