in reply to Re^3: Trouble emailing zip file
in thread Trouble emailing zip file

open(FILE, '<', $attachment) or die "Cannot open $attachment: $!";

You most likely want binmode:

open(FILE, '<', $attachment) or die "Cannot open $attachment: $!"; binmode FILE; ...

Also, you want to eliminate the use of `basename...` in favour of File::Basename::basename:

use File::Basename 'basename';

Also, please consider using a module to send mail, like MIME::Lite instead of talking to sendmail directly...

Replies are listed 'Best First'.
Re^5: Trouble emailing zip file
by TonyNY (Beadle) on Jul 05, 2018 at 19:46 UTC

    Thanks Corion,

    Do you know if MIME::Lite is a pure perl module this way I can copy the source code and use it in my script?

      Yes, MIME::Lite can directly be pasted into your script, or alternatively, simply downloaded into a file Lite.pm. You can easily see whether a module is pure Perl by looking at whether its distribution package contains .xs or .xsp files.