Always enable mail() function

php.internals

Johannes Schlueter

19 years ago
Hi, recently I had the problem that we disable the mail() function if configure can't find the sendmail binary. Is there any real reason for this? I can image a few situations where the binary is in a non-standard location or PHP is compiled on a different host than used. I'd like to commit the attached patch which should always enable mail(), any objections? johannes P.S. If it doesn't come through: The patch is available on http://schlueters.de/~johannes/php/php_mail_always_available.diff too.

Jani Taskinen

19 years ago
So what happens when sendmail really does not exist? --Jani Johannes Schlüter kirjoitti:

Johannes Schlueter

19 years ago
On Wed, 2007-07-11 at 00:49 +0300, Jani Taskinen wrote:
> So what happens when sendmail really does not exist?
The same as if you configure sendmail_oath wrong or move you binary to a host where it is missing: mail() returns false. johannes

Stanislav Malyshev

19 years ago
> The same as if you configure sendmail_oath wrong or move you binary to a > host where it is missing: mail() returns false.
I think it's a correct approach - the fact that sendmail wasn't installed (or installed incorrectly maybe) on build machine shouldn't prevent PHP from sending mail of production machine. If production machine doesn't have sendmail - mail() would fail as would any other function, such as database connection, when environment is not set up correctly.
-- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

Jani Taskinen

19 years ago
On Wed, 2007-07-11 at 00:08 +0200, Johannes Schlüter wrote:
> On Wed, 2007-07-11 at 00:49 +0300, Jani Taskinen wrote: > > So what happens when sendmail really does not exist? > > The same as if you configure sendmail_path wrong or move you binary to a > host where it is missing: mail() returns false.
I forgot there was such ini option. :D But doesn't it give any error for such case? I think it should in case sendmail_path is empty or pointing to something that doesn't exist..? Just commit the patch. I'll remove the configure stuff for you. :) --Jani

Johannes Schlueter

19 years ago
Hi, On Wed, 2007-07-11 at 10:00 +0300, Jani Taskinen wrote:
> Just commit the patch. I'll remove the configure stuff for you. :)
Well, I kept the configure stuff to set the default value of the ini setting when sendmail is found. johannes

Jani Taskinen

19 years ago
On Wed, 2007-07-11 at 11:36 +0200, Johannes Schlüter wrote:
> Hi, > > On Wed, 2007-07-11 at 10:00 +0300, Jani Taskinen wrote: > > Just commit the patch. I'll remove the configure stuff for you. :) > > Well, I kept the configure stuff to set the default value of the ini > setting when sendmail is found.
Good point. I won't touch it then. ;) But you should remove the AC_DEFINE for HAVE_SENDMAIL in the macro in acinclude.m4 as it won't be needed after your patch is committed. --Jani

Richard Lynch

19 years ago
On Tue, July 10, 2007 4:49 pm, Jani Taskinen wrote:
>> I'd like to commit the attached patch which should always enable >> mail(), >> any objections?
+1 I don't see any reason why I should have to install sendmail before I install PHP. PHP is way more important than sendmail, after all. :-) It's not like it needs the header files etc that other libraries rely on for installation, right?
-- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?

Cristian Rodriguez

19 years ago
On 7/10/07, Johannes Schlüter <johannes@php.net> wrote: > Hi, > > recently I had the problem that we disable the mail() function if > configure can't find the sendmail binary. Is there any real reason for > this? I suspect there is no real reason, I have always wondered why is like that. >I can image a few situations where the binary is in a non-standard > location or PHP is compiled on a different host than used. you use sendmail_path in that case ;) > http://schlueters.de/~johannes/php/php_mail_always_available.diff too. +1

Antony Dovgal

19 years ago
No objections from me. On 11.07.2007 01:25, Johannes Schlüter wrote:
> Hi, > > recently I had the problem that we disable the mail() function if > configure can't find the sendmail binary. Is there any real reason for > this? I can image a few situations where the binary is in a non-standard > location or PHP is compiled on a different host than used. > > I'd like to commit the attached patch which should always enable mail(), > any objections? > > johannes > > P.S. If it doesn't come through: The patch is available on > http://schlueters.de/~johannes/php/php_mail_always_available.diff too. >
-- Wbr, Antony Dovgal