Thanks for confirming that the pdf is a binary file.
I tried with the code below (by astrobal from http://www.perlmonks.org/?node_id=1189197) but the pdf file opens with nothing:
$smtp->datasend("Content-Type: application/pdf; name=\"$attachBinaryFi +le\"\n"); $smtp->datasend("Content-Transfer-Encoding: base64\n"); $smtp->datasend("Content-Disposition: attachment; filename=\"$attachBi +naryFile\"\n"); $smtp->datasend("\n"); open(DAT, "$path/$attachBinaryFile") || die("Could not open binary fil +e!"); binmode(DAT); local $/=undef; while (read(DAT, $picture, 4096)) { $buf = &encode_base64( $picture ); $smtp->datasend($buf); } close(DAT); $smtp->datasend("\n"); $smtp->datasend("--$boundary\n");
I changed "Content-Type: image/jpeg;" in his code to "Content-Type: application/pdf;".
In reply to Re^4: Using Net::SMTP to send pdf attachment
by Anonymous Monk
in thread Using Net::SMTP to send pdf attachment
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |