Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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

by tangent (Deacon)
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";


Comment on Re: Read a log file's content and send it in body of email
Select or Download Code
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 scrutinizing the Monastery: (6)
As of 2014-07-13 16:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (250 votes), past polls