Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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

by tangent (Parson)
on Mar 26, 2012 at 22:58 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://961774]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-19 20:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found