my $mailer = new Mail::Mailer 'smtp', Server => 'localhost' or die "Couldn't create a mail object!\n"; my $mail_headers = { 'Content-Type' => 'text/plain', #I tried with 'text/html' for html body. But that one was also failed :( To => [ $to ], From => 'root@mydomain.com', Subject => $subject, }; $mailer->open( $mail_headers ); $mailer->print($mailContents); #$mailContents - Contains the file contents with new lines. $mailer->close();