Charlie Smith wrote:
I'm trying to decode an email that was pop'd. After writing
the body to a disk file using the perl Mail::POP3Client routine
$pop->BodyToFile( $fh, 1);

It looks all like text. So, I run following command to translate

by "it looks all like text" do you mean its "like words" or "an ascii armoured" string?

body of mime message back to pdf for reading.
perl -MMIME::Base64 -ne 'print decode_base64($_)' <test.txt >test.pdf


test.txt is base64 encoded verison correct?

does it have anytyhing in it that is not part of the encoding?

If so then you're decoding that line and putting it in the pdf file

After making sure test.txt is clean:

perl -mstrict -MFile::Slurp -MMIME::Base64 -we 'my $b64 = read_file("test.txt");write_file("test.pdf", decode_base64($b64));'

It cortaks if one of them fail so you're all set AFA error checking...

No error messages, but file size is different from original file poped

Yes, the base 64 encoded verison will be a differtent size than the guts that were encoded...

from email attachment. When pdf file is brought up in browser, there is no data.

- Is the decoded version 0 in size?
- are you outputting a header to tell the browser its a PDF?
- any errors in screen, logs, etc

Example code and url's to the symptoms would be extrememly handy to diagnose the problem, no?

Reply via email to