Gossamer Forum
Home : General : Perl Programming :

sendmail problem

Quote Reply
sendmail problem
hey im working with Apache before i finish a site and put it online...
i am trying to open a pipe and send an email....
the code is v.basic and should work.... however it does. In my error log i get the error:

[error] [client 127.0.0.1] Bad command or file name

Code:


delete @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)}; # stops sendmail path from pointing elsewhere

$mailprog = "|/usr/lib/sendmail -t";

print $query->header;

open(MAIL, "$mailprog")
or die "Can't fork for sendmail: $!\n";

print MAIL "To: $register_email\n";
print MAIL "From: $adminmail\n";
print MAIL "Subject: Temporal - Member Registered\n"; #!!!!!!!!CHANGE!!!!!!!!
print MAIL "\n";
print MAIL "$message";
print MAIL "\n";
close MAIL;


i think this is a problem with my apache because i have used the code before and it used to work. does anyone know what i ca do to fix...assuming there's nothing wrong with my code?
thanks
Pedge
Quote Reply
Re: [pedge] sendmail problem In reply to
You are deleting $ENV{PATH} and so the location of the perl binary can't be found, hence the error.
Quote Reply
Re: [Paul] sendmail problem In reply to
nope... still the same error.
i take it my code correct then?
Quote Reply
Re: [pedge] sendmail problem In reply to
Is this part of a bigger script or have you posted everything?
Quote Reply
Re: [Paul] sendmail problem In reply to
yeah but this section is in a sub routine. i only get the error with i run the sub. the script still executes but it doesnt send the email and i get that error message in my log files.
Quote Reply
Re: [pedge] sendmail problem In reply to
is there anyway i can find out the sendmail path from my system? i am using IndigoPerl Apache Server.
Quote Reply
Re: [pedge] sendmail problem In reply to
$ which sendmail

maybe your sendmail is in /usr/sbin
Quote Reply
Re: [pedge] sendmail problem In reply to
Erm, no wonder. You are using Windows right?....Sendmail is not installed on windows Crazy
Quote Reply
Re: [Paul] sendmail problem In reply to
yeah... so i take it there's nothing i can do.
Quote Reply
Re: [pedge] sendmail problem In reply to
Use SMTP or install a port of Sendmail for windows.

Last edited by:

Paul: Jul 1, 2003, 8:49 AM