I am trying to run a script that takes a text file, compresses it using Archive :: Zip, and sends the zip file as an attachment via smtp using Email :: Sender to create a mime message.
I can send txt files to perl without damage. I can send a file that perl fastens manually without damage. I cannot send a file with a manual encrypted file through perl.
I suspect my problem is that you are reading a zipped file or creating a MIME message. Here is the corresponding code, which is essentially the code from Email :: MIME syntax, where $ fileToSend is the path to the archived file.
Any ideas?
use strict; use warnings; use Email::MIME; use Email::Sender::Transport::SMTP; use Email::Sender::Simple qw(sendmail); use Archive::Zip qw( :ERROR_CODES :CONSTANTS); use IO::All; my $message = Email::MIME->create( header_str => [ From => $sender, To => $recipient, Subject => $subject, ], attributes => { filename => $filename, content_type => 'application/zip', disposition => 'attachment', name => $filename, }, body => io($fileToSend)->binary->all,
source share