I've been following this list with the digest version for some time now
and have started using the -T swith in all of the scripts that I write
now. Unfortunately, I don't know how to send e-mail with the -T switch
turned on. I would normally do it like this...
/usr/bin/perl -wT
use strict
my($name) = John;
my($mailprog) = '/usr/sbin/sendmail';
my($recipient) = '[EMAIL PROTECTED]';
open (MAIL, |$mailprog -t); #The script fails here
Try this:
open (MAIL, |-, $mailprog , -t); #avoids using the shell
or you can do at the top of script:
$ENV{PATH} = 'bin:/usr/bin'; # restrict
open (MAIL, |-, $mailprog , -t);
gives me the following in the error log...
Can't use an undefined value as filehandle reference at
/home/rob/cgi-bin/completeOrder.cgi line 9.
On Thu, 11 Oct 2001, Kipp, James wrote:
my($name) = John;
my($mailprog) = '/usr/sbin/sendmail';
Rob wrote:
I've been following this list with the digest version for some time now
and have started using the -T swith in all of the scripts that I write
now. Unfortunately, I don't know how to send e-mail with the -T switch
turned on. I would normally do it like this...
open (MAIL
open (MAIL, |-, $mailprog , -t);
try changing $mailprog to /usr/sbin/sendmail
Can't use an undefined value as filehandle reference at
/home/rob/cgi-bin/completeOrder.cgi line 9.
did you try :
or you can do at the top of script:
$ENV{PATH} = 'bin:/usr/bin'; # restrict the path env var
Thanks, this one worked.
$ENV{PATH}='/usr/sbin';
my($mailprog) = 'sendmail';
my($recipient) = '[EMAIL PROTECTED]';
open (MAIL, |$mailprog -t) ;
#Do mail stuff
delete $ENV{PATH};
:wq
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]