ok here it what I did and it is emailing sporadically or not at all???
Also it is not placing the array data into the email body???
it is like the if clause it not working.
thank you!
## Set pragmas
use strict;
use Mail::Sendmail;
## Set and edit variables
my $foreigntapes="/usr/local/log/foreign_tapes.log";
delete $ENV{'IFS'};
local $ENV{'PATH'} =
"/usr/epoch/bin:/usr/epoch/EB/bin:/usr/bin:/usr/sbin:/bin:/sbin";
#print $ENV{'PATH'},"\n";
## Traverse through array and play with data
open (OUT, ">$foreigntapes") || die "could not open file:$!";
my @ftapes = grep s/^barcode=//, `evmvol -w label_state=1`;
print OUT "@ftapes";
if ( -s OUT ) {
my %mailman = ( From => 'EDM01 <[EMAIL PROTECTED]>',
To => 'Derek Smith <[EMAIL PROTECTED]>',
Subject => "Foreign Tapes Found, now attmepting to
label" ,
Message => print OUT "@ftapes" );
sendmail (%mailman) or die $Mail::Sendmail::error;
foreach (@ftapes) {
print $_;
#`evmlabel -l st_9840_acs_0 -t 9840S -b$_`
}
close (OUT);
} else {
my $foo="/tmp/ftapes_runfile";
open (RUNFILE, ">$foo") || die "could not open runfile:
$!;"
#exit 0;
}
close (RUNFILE);
derek