php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33434 the mail() function does not call the needed function in mail.c
Submitted: 2005-06-22 13:36 UTC Modified: 2005-06-30 13:09 UTC
From: robert at bsd dot hu Assigned:
Status: Not a bug Package: Mail related
PHP Version: 4.3.11 OS: IRIX 6.5
Private report: No CVE-ID: None
 [2005-06-22 13:36 UTC] robert at bsd dot hu
Description:
------------
When I try to use the mail() function it always returns FALSE. I've put a debug line:
--- ---
    83  PHP_FUNCTION(mail)
    84  {
    85          char *to=NULL, *message=NULL, *headers=NULL;
    86          char *subject=NULL, *extra_cmd=NULL;
    87          int to_len, message_len, headers_len;
    88          int subject_len, extra_cmd_len, i;
    89          char *to_r, *subject_r;
    90
    91          php_error_docref(NULL TSRMLS_CC, E_WARNING, "called mail() function.");
--- ---
There is no such warning message in the logs. I've also tried to change the sendmail_path to a script that touches a file. It does not get executed.


Reproduce code:
---------------
Anything that uses mail();.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-22 14:16 UTC] tony2001@php.net
What does this output for you ?
<?php
var_dump(mail());
?>

And make sure that sendmail headers were found during ./configure execution (check `./configure ..... | grep -i sendmail`).
 [2005-06-22 14:47 UTC] robert at bsd dot hu
it finds sendmail in /usr/lib/sendmail and the dump_var(mail()); returns NULL
 [2005-06-22 15:32 UTC] tony2001@php.net
and in main/php_config.h HAVE_SENDMAIL is ... ?
 [2005-06-22 15:35 UTC] robert at bsd dot hu
#define HAVE_SENDMAIL 1
 [2005-06-22 15:41 UTC] tony2001@php.net
Then I don't see how it could happen that in mail.c HAVE_SENDMAIL is 0.
Please try fresh snapshot from http://snaps.php.net and if it doesn't work too - try to investigate why HAVE_SENDMAIL in mail.c is zero, while in included file it's 1.
 [2005-06-22 15:46 UTC] robert at bsd dot hu
I've defined HAVE_SENDMAIL 1 in mail.c just to be sure
and it seems it is ok:
$ strings .libs/libphp4.so|grep mail
mail
mb_send_mail
mb_orig_mail
mail
vpopmail.directory
called mail() function.
sendmail_path
Permission denied: unable to execute shell to run mail delivery binary '%s'
Could not execute mail delivery program '%s'
Path to sendmail
sendmail_from
sendmail_path
/usr/lib/sendmail -t -i
 [2005-06-22 16:06 UTC] robert at bsd dot hu
same with the snapshot.
 [2005-06-22 17:10 UTC] tony2001@php.net
That's interesting.
From what I can see, mail.c includes php.h, which includes tsrm_virtual_cwd.h, which includes tsrm_config_common.h, which includes tsrm_config.h, which in turn includes php_config.h, where HAVE_SENDMAIL is defined.

I.e. it looks like this:
mail.c
 php.h
  tsrm_config.h
   tsrm_config_common.h
    tsrm_config.h
     php_config.h 

Could you plz figure out which one of these includes doesn't get included and why?
 [2005-06-22 17:14 UTC] robert at bsd dot hu
As i told you i've added #define HAVE_SENDMAIL 1 to
mail.c just after the includes and before the #ifded HAVE_SENDMAIL. And as you can see strings shows that the functions are compiled in. I doubt that this is a header problem, because they get compiled in w/o my define too.
 [2005-06-22 17:26 UTC] tony2001@php.net
>As i told you i've added #define HAVE_SENDMAIL 1 to
>mail.c just after the includes and before the #ifded
> HAVE_SENDMAIL

Right. And this should have caused warning saying that "HAVE_SENDMAIL" have been redefined (as it does for me).
That's why I assume that it was never defined before because php_config.h didn't get included.
That's pretty weird behaviour and I haven't heard about anyone who is able to reproduce it.
 [2005-06-22 18:02 UTC] robert at bsd dot hu
I've defined HAVE_SENDMAIL in CFLAGS just to be sure it gets defined everywhere, but of course i still have the same issue.
 [2005-06-22 18:15 UTC] tony2001@php.net
That's not what I asked you to do.

 [2005-06-22 18:31 UTC] robert at bsd dot hu
tsrm_config.h is missing.
 [2005-06-22 19:21 UTC] tony2001@php.net
It doesn't exist at all or it's just empty?
Could you provide access to this machine?
 [2005-06-22 19:23 UTC] robert at bsd dot hu
Sorry. I fucked it. It exists and includes #include <../main/php_config.h>. No sorry i can't give access to the machine.
 [2005-06-22 19:31 UTC] tony2001@php.net
Ok, we're back again to the question: what is missing? 
 [2005-06-30 00:55 UTC] robert at bsd dot hu
It seems nothing is missing. I am relly courious what could be the problem. It is just wo wierd. You can check phpinfo() here: http://users.silihost.hu/phpinfo.php
Maybe you will catch something.
 [2005-06-30 09:01 UTC] sniper@php.net
You really need to have sendmail (or something compatible) installed. It won't magically just work otherwise..

 [2005-06-30 13:09 UTC] robert at bsd dot hu
Have you even read the comments? PHP does not even try to execute the given sendmail binary.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC