Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Read a log file's content and send it in body of email

by tangent (Priest)
on Mar 26, 2012 at 22:58 UTC ( #961774=note: print w/replies, xml ) Need Help??


in reply to Read a log file's content and send it in body of email

Where you say "body => @lines" there is nothing in @lines. To fix that insert at the top:
my @lines = <FH>;
However, unless your file is HTML your email will be garbled (e.g. it will not display linebreaks properly). If your file is not HTML then there is no need to use Email::MIME::CreateHTML, just use Email::Send:
use strict; use warnings; use Email::Send; open(FH, "</apps/dryrun-merges/logs/dryrun-merge-report") or die("FAILED to open dryrun merge report: $!"); my @lines = <FH>; close(FH); my $message = <<'__MESSAGE__'; From: kkurnala@wsgc.com To: kkurnala@wsgc.com,wso@wsgc.com,SJStephens@wsgc.com Subject: Daily Dry-Run Merge Report - Test Message __MESSAGE__ $message .= join('',@lines); my $sender = Email::Send->new({mailer => 'Sendmail'}); my $result = $sender->send($message); print "$result\n";

Replies are listed 'Best First'.
Re^2: Read a log file's content and send it in body of email
by kkurnala (Initiate) on Mar 27, 2012 at 02:38 UTC
    Thank you very much Tangent, Really Appreciate your Time ! Respect for the Community !! Your suggesstion did really help me. Thanks, Krishna.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://961774]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2016-09-29 10:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (551 votes). Check out past polls.