Re: why is this not a bug?
| From: | Rasmus Lerdorf | Date: | Thu, 13 Jul 2000 06:33:04 +0000 |
| Subject: | Re: why is this not a bug? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-6386@lists.php.net to get a copy of this message | ||
> If I configure php4 such that I tell it sendmail_path is /usr/local/turkey -t
> (not a valid filename) it, still merrily returns '1' when I invoke mail(). How
> can it return a true value on a command that has to fail?
>
> This is pretty frustrating...
>
>
> php4pl2/OSX/Apache 1.3.12
From ext/standard/mail.c:
sendmail = popen(sendmail_path, "w");
if (sendmail) {
fprintf(sendmail, "To: %s\n", to);
fprintf(sendmail, "Subject: %s\n", subject);
if (headers != NULL) {
fprintf(sendmail, "%s\n", headers);
}
fprintf(sendmail, "\n%s\n", message);
ret = pclose(sendmail);
if (ret == -1) {
return 0;
} else {
return 1;
}
} else {
php_error(E_WARNING, "Could not execute mail delivery program");
return 0;
}
From the popen() man page:
RETURN VALUE
The popen function returns NULL if the fork(2) or pipe(2) calls
fail, or if it cannot allocate memory.
So, either your OSX is broken (which is not all that unlikely) or your
sendmail_path is not what you think it is. Write yourself a tiny little C
program to test popen() on your system.
-Rasmus