Ok, we are almost there, you need again a module and a very light change. I tried not to change your code too much just to get it work on my machine.
You need to change, actually add one line to this part:
use IO::All; # install this module first
push @parts, Email::MIME->create(
attributes => {
filename => $attachments{doc_name},
content_type => $attachments{doc_mime_type},
disposition => 'attachment',
encoding => 'base64',
name => $attachments{doc_name}
},
body => io($attachments{doc_name})->all, # add this line
);
For the illegal seek error, just delete these lines, you don't need them:
#print "error1 $!\n";
#print "error2 $Mail::Sendmail::error\n";
Cheers, have fun!
|