Deborah Scott wrote:
> 
> >To make this work, you have to specify the list variable ($i):
> 
> >$file = "/suidbin/sendmail -t";
> >$var = "the_file.txt";
> >
> >open(FILE, "$var") || die "cant open text file";
> >@file = <FILE>;
> >close(FILE);
> >foreach $i (@addressee) {
> >      open(MAIL, "|$file $addressee") || die "can't open sendmail";
> >      print MAIL "To: $i\n" ;
> >      print MAIL "From: tom_employee\n" ;
> >      print MAIL "Subject: Email Message\n" ;
> >
> >foreach(@file){
> >       print MAIL;
> >}
> >}
> >close ( MAIL ) ;
> >
> 
> This worked perfectly on UNIX, but I also had to substitute $i for
> $addressee before it would work on the NT server.
> 
> NOW MY NEXT PROBLEM...
> 
> The NT machine will only read the first line of "the_file.txt."  The 'cat'
> command doesn't seem to work on NT. (The UNIX machine has no problem reading
> and printing the entire txt. file.)

You probably need binmode

perldoc -f binmode


my $file = '/suidbin/sendmail -t';
my $var  = 'the_file.txt';

open FILE, $var or die "cant open $var: $!";
binmode FILE;
my @file = <FILE>;
close FILE;

foreach my $i ( @addressee ) {
    open MAIL, "|$file $addressee" or die "can't open sendmail: $!";
    print MAIL "To: $i\n" ;
    print MAIL "From: tom_employee\n" ;
    print MAIL "Subject: Email Message\n" ;

    print MAIL @file;

    close MAIL or die "Cannot close pipe to sendmail: $!";
    }



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to