On Fri, 2003-01-24 at 15:35, Scott, Deborah wrote:
> I asked this before, but I probably made the question too long and confusing
> to follow.
> 
> How do I send an email using perl? 
> The path for the sendmail program is:
>       h:/blah/blah/SENDMAIL/sendmail.exe
> 
> I want it to open the contents of a particular file. Then send the contents
> of the file as an email to 
>       [EMAIL PROTECTED]
> 
> 
> Thanks,
> --Deborah
> 



if your file is a text file....

#! /usr/bin/perl -w

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

open(FILE, "$var") || die "cant open text file";
@file = <FILE>;
close(FILE);

##open pipe to sendmail
open(MAIL, "|$file") || die "cant open sendmail";
print MAIL "To: blah\@devnull.bz\n" ;
print MAIL "From: blah\@cyberspace.org\n" ;
print MAIL "Subject: Fresh\n\n" ;
foreach(@file){
        print MAIL;
}
close ( MAIL ) ;


-- 
jd
[EMAIL PROTECTED]

Bad spellers of the world untie!



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

Reply via email to