#!/usr/bin/perl use Mail::Sender; open(FH,"file.txt"); my $var; while() { $var .= $_; } close(FH); eval { Mail::Sender->new( {from => '', smtp => ''}) ->OpenMultipart({ to => '', subject => 'Subject Here!', multipart => 'related', }) ->Part({ ctype => 'text/html', disposition => 'NONE', msg => $var}) ->Attach({ description => 'test file', ctype => 'application/octet-stream', encoding => 'base64', disposition => "attachment; filename= file1 ", file => 'file1' }) ->Close(); } or print "Error sending mail: $Mail::Sender::Error\n";