Enjoy!use MIME::QuotedPrint; use MIME::Base64; use Mail::Sendmail 0.75; # doesn't work with v. 0.74! %mail = ( from => 'you@domain.tld', to => 'whoever@someplace.tld', subject => 'Test attachment', ); $boundary = "====" . time() . "===="; $mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\""; $message = encode_qp( "Some message" ); $file = $^X; # This is the perl executable open (F, $file) or die "Cannot read $file: $!"; binmode F; undef $/; $mail{body} = encode_base64(<F>); close F; $boundary = '--'.$boundary; $mail{body} = <<END_OF_BODY; $boundary Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable $message $boundary Content-Type: application/octet-stream; name="$^X" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="$^X" $mail{body} $boundary-- END_OF_BODY sendmail(%mail) || print "Error: $Mail::Sendmail::error\n";
In reply to Re: Sending email attachments
by rupesh
in thread Sending email attachments
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |