You must use Mail :: Sender to send email attachments
#!/usr/bin/perl use Mail::Sender $to = ' email1@example1.com , email2@example2.com '; $sender =new Mail::Sender { smtp => 'smtp.mailserver.com', from => ' script@somedomain.com , }); $subject = 'This is a Test Email'; $sender->OpenMultipart({ to => "$to", subject => "$subject", }); $sender->Body; $sender->SendLineEnc("Test line 1"); $sender->SendLineEnc("Test line 2"); $sender->Attach({ description => 'Test file', ctype => 'application/x-zip-encoded', encoding => 'Base64', disposition => 'attachment; filename="File.zip"; type="ZIP archive"', file => "$file", }); $sender->Close(); exit();
or using MIME :: Lite
use MIME::Lite; $msg = MIME::Lite->new ( From => $from_address, To => $to_address, Subject => $subject, Type =>'multipart/mixed' ) or die "$!\n";
user966588
source share