use strict; use warnings; use MIME::Lite; my $msg = MIME::Lite->build( From => 'from@mail.address', To => 'recipient@mail.address', Subject => 'some subject', Type => 'multipart/mixed', ); $msg->attach( Type => 'TEXT', Data => "see attached file\n\n" ); $msg->attach( Type => 'AUTO', # change AUTO to your prefered type if you wish Path => '/path/to/some/file', ); # MIME::Lite->send('smtp', 'some.smtp.host' ); # don't use sendmail, see POD $msg->send();