i want to mail the contents of a log file of another script . I have tried the code it works , but however the output is not i expected. I want the output in line by line exactly like in LOG.txt, but i get it in as a paragraph in the body.
my $HOME ='/apps/stephen/data';
my $FILE ="$HOME/LOG.txt";
my @HTML =();
sub copyfile
{
`$HOME/APPL.ksh > $FILE`;
push(@HTML,`cat $FILE`);
&sendMail;
}
sub sendMail
{
$sub="TEST";
$from='ABC@ABC.com';
$to='ABC@ABC.com';
open(MAIL, "|/usr/lib/sendmail -t");
print MAIL "From: $from \12"; print MAIL "To: $to \12";print MAIL "Cc: $Cc \12";
print MAIL "Subject: $sub \12";
print MAIL "Content-Type: text/html \12";
print MAIL "Content-Disposition:inline \12";
print MAIL @HTML;
close(MAIL);
}
sub init
{
copyfile;
}
init;
Add missing MIME-Version:
header to complete Content-*:
headers.
open(MAIL, "|/usr/lib/sendmail -i -t");
print MAIL << "END";
From: $from
To: $to
Cc: $Cc
Subject: $sub
MIME-Version: 1.0
Content-Type: text/html
Content-Disposition: inline
END
print MAIL @HTML;
close(MAIL)
;