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.
Index: ext/mbstring/mbstring.c
===================================================================
RCS file: /repository/php-src/ext/mbstring/mbstring.c,v
retrieving revision 1.268
diff -u -p -r1.268 mbstring.c
--- ext/mbstring/mbstring.c 4 Apr 2007 15:23:09 -0000 1.268
+++ ext/mbstring/mbstring.c 10 Jul 2007 21:16:22 -0000
@@ -3317,7 +3317,6 @@ PHP_FUNCTION(mb_decode_numericentity)
/* {{{ proto int mb_send_mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
* Sends an email message with MIME scheme
*/
-#if HAVE_SENDMAIL
#define SKIP_LONG_HEADER_SEP_MBSTRING(str, pos) \
if (str[pos] == '\r' && str[pos + 1] == '\n' && (str[pos + 2] == ' ' || str[pos + 2] == '\t')) { \
@@ -3821,16 +3820,6 @@ PHP_FUNCTION(mb_send_mail)
#undef PHP_MBSTR_MAIL_MIME_HEADER2
#undef PHP_MBSTR_MAIL_MIME_HEADER3
#undef PHP_MBSTR_MAIL_MIME_HEADER4
-
-#else /* HAVE_SENDMAIL */
-
-PHP_FUNCTION(mb_send_mail)
-{
- RETURN_FALSE;
-}
-
-#endif /* HAVE_SENDMAIL */
-
/* }}} */
/* {{{ proto mixed mb_get_info([string type])
Index: ext/standard/basic_functions.c
===================================================================
RCS file: /repository/php-src/ext/standard/basic_functions.c,v
retrieving revision 1.862
diff -u -p -r1.862 basic_functions.c
--- ext/standard/basic_functions.c 3 Jul 2007 10:22:55 -0000 1.862
+++ ext/standard/basic_functions.c 10 Jul 2007 21:16:23 -0000
@@ -1816,7 +1816,6 @@ ZEND_END_ARG_INFO()
#endif
/* }}} */
/* {{{ mail.c */
-#ifdef HAVE_SENDMAIL
static
ZEND_BEGIN_ARG_INFO(arginfo_ezmlm_hash, 0)
ZEND_ARG_INFO(0, addr)
@@ -1830,7 +1829,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_mail, 0,
ZEND_ARG_INFO(0, additional_headers)
ZEND_ARG_INFO(0, additional_parameters)
ZEND_END_ARG_INFO()
-#endif
/* }}} */
/* {{{ math.c */
static
@@ -3693,10 +3691,8 @@ zend_function_entry basic_functions[] =
PHP_FALIAS(diskfreespace, disk_free_space, arginfo_disk_free_space)
/* functions from mail.c */
-#ifdef HAVE_SENDMAIL
PHP_FE(mail, arginfo_mail)
PHP_FE(ezmlm_hash, arginfo_ezmlm_hash)
-#endif
/* functions from syslog.c */
#ifdef HAVE_SYSLOG_H
@@ -4944,14 +4940,9 @@ PHPAPI int _php_error_log(int opt_err, c
case 1: /*send an email */
{
-#if HAVE_SENDMAIL
if (!php_mail(opt, "PHP error_log message", message, headers, NULL TSRMLS_CC)) {
return FAILURE;
}
-#else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Mail option not available!");
- return FAILURE;
-#endif
}
break;
Index: ext/standard/mail.c
===================================================================
RCS file: /repository/php-src/ext/standard/mail.c,v
retrieving revision 1.93
diff -u -p -r1.93 mail.c
--- ext/standard/mail.c 10 Jul 2007 20:23:26 -0000 1.93
+++ ext/standard/mail.c 10 Jul 2007 21:16:23 -0000
@@ -35,7 +35,6 @@
#include "php_ini.h"
#include "exec.h"
-#if HAVE_SENDMAIL
#ifdef PHP_WIN32
#include "win32/sendmail.h"
#endif
@@ -271,13 +270,6 @@ PHP_MINFO_FUNCTION(mail)
}
/* }}} */
-#else
-
-PHP_FUNCTION(mail) {}
-PHP_MINFO_FUNCTION(mail) {}
-
-#endif
-
/*
* Local variables:
* tab-width: 4
Index: ext/standard/php_mail.h
===================================================================
RCS file: /repository/php-src/ext/standard/php_mail.h,v
retrieving revision 1.20
diff -u -p -r1.20 php_mail.h
--- ext/standard/php_mail.h 1 Jan 2007 09:29:32 -0000 1.20
+++ ext/standard/php_mail.h 10 Jul 2007 21:16:23 -0000
@@ -24,11 +24,7 @@
PHP_FUNCTION(mail);
PHP_MINFO_FUNCTION(mail);
-#if HAVE_SENDMAIL
-
PHP_FUNCTION(ezmlm_hash);
PHPAPI extern int php_mail(char *to, char *subject, char *message, char *headers, char *extra_cmd TSRMLS_DC);
-#endif
-
#endif /* PHP_MAIL_H */
Index: main/main.c
===================================================================
RCS file: /repository/php-src/main/main.c,v
retrieving revision 1.734
diff -u -p -r1.734 main.c
--- main/main.c 10 Jul 2007 18:42:01 -0000 1.734
+++ main/main.c 10 Jul 2007 21:16:23 -0000
@@ -341,7 +341,7 @@ static PHP_INI_MH(OnUpdateDefaultMimetyp
#if defined(PHP_PROG_SENDMAIL) && !defined(NETWARE)
# define DEFAULT_SENDMAIL_PATH PHP_PROG_SENDMAIL " -t -i "
#else
-# define DEFAULT_SENDMAIL_PATH NULL
+# define DEFAULT_SENDMAIL_PATH "/usr/sbin/sendmail -t -i"
#endif
/* {{{ PHP_INI
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php