[EMAIL PROTECTED] wrote:

ok here it what I did and it is emailing sproadically. Also it is not placing the array data into the email body???

## 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" );



print OUT "@ftapes" will print the array @ftapes on "/usr/local/log/foreign_tapes.log". Maybe what do you want is:

Message    =>  "@ftapes" # elements joined by ' '

or

Message    =>  join "\n","@ftapes" # elements joined by "\n"




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 B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams






Bob Showalter <[EMAIL PROTECTED]> 06/03/2004 05:00 PM


To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
cc: Subject: RE: using Mail::Sendmail



[EMAIL PROTECTED] wrote:


I was looking at the Mail::Sendmail module from CPAN and I did not
find anything that showed printing a body. How do I print a body of
text data from a variable?



I haven't used Mail::Sendmail, but it looks like the message body goes in the Message entry of the hash passed to sendmail().

[snip]


sendmail (%mailman) or die $Mail::Sendmail::error;
print %mailman <<EO_SIG;
EDM foreign tapes were found, \n, print OUT "@ftapes"
EO_SIG;



Erm, what are those last 3 lines supposed to be? That won't compile.

Anyway, build up your message in a string and assign it to $mailman{Message}
before calling sendmail(). That's what sends the message.








--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to