#!/usr/bin/perl -w

use strict;
use warnings;

use Email::Send;

my $email="giebink\@ifa.hawaii.edu";

my $today = `date -u +%Y%m%d`;
my $logfile = "/data/ipp001.0/ippTests/tap/summary";

my @logcontents;

#check existence of log file
if (open (FPTR, $logfile)) {
  @logcontents = <FPTR>;
  } else {
  @logcontents = "FAIL: Can't Open File: $logfile\n";
}
close (FPTR);

my $message =<<END;
To: $email
From: giebink\@ifa.hawaii.edu
Subject: $ARGV[0] test summary $today

@logcontents

END

my $sender = Email::Send->new({mailer => 'SMTP'});
$sender->mailer_args([Host => 'hale.ifa.hawaii.edu']);
$sender->send($message);
