in reply to Re: saving pdf attachments
in thread saving pdf attachments

Hi Tachyon, I am using my own MimeReader.pm (I got frustrated trying to get Mime::Tools to work.) I have
all the parts and can save binary, text, quoted-printable (usually, just having trouble with pdfs).
I did take the email in Outlook and saved the troublesome attachment, and it is valid. I also compared that file to the
one I save (that doesn't work), and found that the line-endings are the probable problem. Just not sure what about them
is wrong.

Replies are listed 'Best First'.
Re: Re: Re: saving pdf attachments
by tachyon (Chancellor) on Feb 27, 2003 at 15:13 UTC

    OK so the problem is that your MimeReader.pm can not cope with what the MIME it is getting.

    You probably are not parsing the corrupt MIME that some mail clients send 'correctly'! I have a webmail app with its own MIME parser built in. It has proven pretty reliable in practice at extracting attachemnts. Drop me a line and I will send you the code. Email jfreeman@tassie.net.au

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

      Hi Tachyon, I figured out the problem. For pdf files at least, the quoted-printable format was missing an "=" at the end of one or two lines. So, when I ran it through the MIME::QuotedPrint::decode_qp, the extra control-M (\r) was getting stripped. I'm not sure why it works, but I'm doing a s/\n$/\r\n/ on lines that don't end with =.

      Thanks for all the help to everyone!

      busch4al

        You should be unwrapping it accoring to the spec (soft line breaks). Then modifying this to allow for the corrupt examples. But I guess you are now.....

        cheers

        tachyon

        s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print