Does anyone see anything logically wrong with my code b/c I am still not
receiving the correct data in the email. The data is a # 1 when it should
be a listing of Exxxxx strings.
thank you!
## Set pragmas
use strict;
use MIME::Lite;
## 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 @ftapes ) {
my $msg = MIME::Lite->new(
From => 'EDM01 <[EMAIL PROTECTED]>',
To => 'Derek Smith <[EMAIL PROTECTED]>',
Subject => "Foreign Tapes Found, now attmepting to
label",
Data => print "@ftapes" );
msg->send;
#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:
$!;"
#}
#close (RUNFILE);
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
<[EMAIL PROTECTED]>
06/04/2004 10:58 AM
Please respond to cslyon
To: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
cc:
Subject: RE: sendmail
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 04, 2004 6:39 AM
> To: [EMAIL PROTECTED]
> Subject: sendmail
>
> 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";
I would try to test something else besides the handle. I know you can do
these types of tests against a file but a handle? Not sure if that is the
best way to do it. Besides, you are testing if the file exists and have a
nonzero size against a handle. Test the array maybe?
> 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" );
Try this for the Message line instead:
Message => "@ftapes" );
You might also want to try MIME::Lite for sending this. I know there is a
bunch of discussion about Mail::Sendmail and having it work correctly and
everybody recommends MIME::Lite instead. I was using Mail::Sendmail for a
bunch of things and moved everything over to MIME::Lite. Works like a
charm!
> 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
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>