in reply to Re^2: email pdf file - file damaged
in thread email pdf file - file damaged

I would maybe use File::Slurp::slurp or write my own file slurper:

sub slurp { open my $fh, "<", $_[0] or die "Couldn't open '$_[0]' for reading: $!"; binmode $fh; local $/; my $result = <>; };

Maybe your (Content-)Encoding of quoted-printable is inappropriate for the type of file you're sending? I would think a Content-Encoding that uses base64 would be better maybe, if Email::Simple supports such. But then, I use MIME::Lite for most of my mailing needs.

Replies are listed 'Best First'.
Re^4: email pdf file - file damaged
by madison.sacd (Novice) on May 07, 2007 at 07:55 UTC
    Thanks, Corion. After I changed to use "base64". It works fine now. The reason I used "quoted-printable" is that the example code on cpan is written like this. It seems not working now. Again, thank you so much.
      I know this is a SUPER old thread - but THANK YOU! I was wondering why my attached PDF was coming up with an error about the font not being accessible. I was doing:
      push @parts, Email::MIME->create( attributes => { filename => $filename, content_type => "application/pdf", encoding => "quoted-printable", name => $filename, }, body => io( $opts->{attach_file} )->binary->all, )
      But tweaked it to use base64 and it works fine now:
      push @parts, Email::MIME->create( attributes => { filename => $filename, content_type => "application/pdf", encoding => "base64", name => $filename, }, body => io( $opts->{attach_file} )->binary->all, )


      Would never have thought of that!