$loglines = `tail -50 $logfile`; $message = <<"*END*"; This email was generated after an error was detected, the NetRestartService.pl script was executed. Log file: $loglines *END* $msg = MIME::Lite->new( From =>'NetRestartService', To =>'Test@test.com', Cc =>'Test2@test2.com', Subject =>'Perl Script to restart remote NT Service - NetRestartService.pl', Data => message , ); $msg->send;