ID: 43348 Updated by: [EMAIL PROTECTED] Reported By: RQuadling at GMail dot com Status: Assigned Bug Type: Mail related Operating System: Windows XP SP2 PHP Version: 5.3CVS-2007-11-20 (snap) Assigned To: johannes New Comment:
a better fix is: if (!sendmail_path || !*sendmail_path) let me know if you want me to commit this. Previous Comments: ------------------------------------------------------------------------ [2008-04-17 14:45:55] RQuadling at GMail dot com Hi. I have finally managed to get php to compile for windows (yippee for me). So I can now try and get mail() working again. The issue is that in ext/standard/mail.c (/* $Id: mail.c,v 1.87.2.1.2.7.2.3 2007/12/31 07:17:15 sebastian Exp $ */), line 197, the test of ... if (!sendmail_path) always evaluates to false when there is no sendmail_path which would be the case on windows. The next line differentiates between processing for windows/netware and everything else. If the test is if(0 == strlen(sendmail_path)) then that would work. The INI_STR call in Line 194 always returns a string if the directive is known (doesn't need to be set, just has to exist as a directive). So, I've attached a patch which I have compiled and tested on Windows. This is in relation to bug http://bugs.php.net/bug.php?id=43348 Index: mail.c =================================================================== RCS file: /repository/php-src/ext/standard/mail.c,v retrieving revision 1.87.2.1.2.7.2.3 diff -u -u -r1.87.2.1.2.7.2.3 mail.c --- mail.c 31 Dec 2007 07:17:15 -0000 1.87.2.1.2.7.2.3 +++ mail.c 17 Apr 2008 14:40:33 -0000 @@ -194,7 +194,7 @@ char *sendmail_path = INI_STR("sendmail_path"); char *sendmail_cmd = NULL; - if (!sendmail_path) { + if (0 == strlen(sendmail_path)) { #if (defined PHP_WIN32 || defined NETWARE) /* handle old style win smtp sending */ if (TSendMail(INI_STR("SMTP"), &tsm_err, &tsm_errmsg, headers, subject, to, message, NULL, NULL, NULL TSRMLS_CC) == FAILURE) { ------------------------------------------------------------------------ [2007-12-04 16:50:44] RQuadling at GMail dot com Just to iterate, the mail function for windows in the CVS is broken for CLI, CGI and ISAPI. ------------------------------------------------------------------------ [2007-12-04 15:54:42] pipaff at comptrio dot com Update: Switched back to CGI and mail works again... lost the ability to 'except users' from safe_mode in Apache config (php_admin_value/flag), but mail works. This is on a Linux box CentOS4... 2.6.9 kernel ------------------------------------------------------------------------ [2007-12-04 08:44:57] pipaff at comptrio dot com The title caught my eye right away... PHP 5.2.4 as DSO fails to work properly (Apache 2.0.61) $mail = mail("[EMAIL PROTECTED]","test","test inside","From: [EMAIL PROTECTED]"); if($mail){ print "true"; }else{ print"false"; } Expected: "true" and an email to be received (or false without email) Actual: "true", but no email received, no error message/log, no record in MTA (exim) Recently Changed: CGI to DSO, same code worked prior using same PHP/Apache version ------------------------------------------------------------------------ [2007-11-20 17:04:54] RQuadling at GMail dot com ====C:\testmail.php==== <?php ini_set('SMTP', 'gmail-smtp-in.l.google.com'); // Force GMail to be the server. $s_Email = 'RQuadling' . '@' . 'GMail.com'; var_dump(mail($s_Email, PHP_VERSION, 'Your message', "From:$s_Email")); ?> and then C:\PHP4\PHP -n C:\testmail.php I get 4.4.7-dev message C:\PHP5\PHP -n C:\testmail.php I get nothing. V:\PHP5.2.2RC2-dev\PHP -n C:\testmail.php I get 5.2.2RC2-dev message Today, we made a change from McAfee AV to Symantec AV. I am getting little alerts for PHP4 and the PHP5.2.2 messages going out, but nothing for PHP5.3.0-dev ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/43348 -- Edit this bug report at http://bugs.php.net/?id=43348&edit=1