ID:               28976
 Comment by:       Charlesk at netgaintechnology dot com
 Reported By:      kdaniel at aosepc dot com
 Status:           Open
 Bug Type:         Mail related
 Operating System: Windows\Apache
 PHP Version:      4.3.6
 New Comment:

It seems to me that this was thought of but never implemented.  In
sendmail.c:

        if (headers) {
                char *pos = NULL;
                size_t i;

                /* Use PCRE to trim the header into the right format */
                if (NULL == (headers = php_win32_mail_trim_header(headers
TSRMLS_CC))) {
                        *error = W32_SM_PCRE_ERROR;
                        return FAILURE;
                }

                /* Create a lowercased header for all the searches so we're finally
case
                 * insensitive when searching for a pattern. */
                if (NULL == (headers_lc = estrdup(headers))) {
                        efree(headers);
                        *error = OUT_OF_MEMORY;
                        return FAILURE;
                }
                for (i = 0; i < strlen(headers_lc); i++) {
                        headers_lc[i] = tolower(headers_lc[i]);
                }
        }
 
        /* Fall back to sendmail_from php.ini setting */
        if (mailRPath && *mailRPath) {
                RPath = estrdup(mailRPath);
        }
        else if (INI_STR("sendmail_from")) {
                RPath = estrdup(INI_STR("sendmail_from"));
        } else {
                if (headers) {
                        efree(headers);
                        efree(headers_lc);
                }
                *error = W32_SM_SENDMAIL_FROM_NOT_SET;
                return FAILURE;
        }


I would think that in the if (headers) section there should be some
code to set the mailRPath if the From header is found in headers.  That
way when it falls into the if (mailRPath && *mailRPath) section it will
appropriately assign the from to the return path.  

Can this be fixed soon?

Thanks
Charles


Previous Comments:
------------------------------------------------------------------------

[2004-08-24 19:53:10] dv at josheli dot com

http://marc.theaimsgroup.com/?l=php-dev&m=109286883222906&w=2

------------------------------------------------------------------------

[2004-08-23 19:19:30] kdaniel at aosepc dot com

Yes it is.  The problem exists in sendmail.c

The code as follows:

/* Fall back to sendmail_from php.ini setting */
        if (mailRPath && *mailRPath) {
                RPath = estrdup(mailRPath);
        }
        else if (INI_STR("sendmail_from")) {
                RPath = estrdup(INI_STR("sendmail_from"));
        } else {
                if (headers) {
                        efree(headers);
                        efree(headers_lc);
                }
                *error = W32_SM_SENDMAIL_FROM_NOT_SET;
                return FAILURE;
        }

Should be changed to:

/* Fall back to sendmail_from php.ini setting */
        if (mailRPath && *mailRPath) {
                RPath = estrdup(mailRPath);
        }
        else if (INI_STR("sendmail_from")) {
                RPath = estrdup(INI_STR("sendmail_from"));
        } else {
                if (headers) {
                        efree(headers);
                        efree(headers_lc);
                } else {
                        *error = W32_SM_SENDMAIL_FROM_NOT_SET;
                        return FAILURE;
                }
        }


I have not tested this, it is just a guess.

Kevin

------------------------------------------------------------------------

[2004-08-23 19:02:33] joe at inexo dot com

It's not coming from php.ini.

------------------------------------------------------------------------

[2004-08-18 23:07:34] dv at josheli dot com

using cli PHP 5 and latest snap (php5-win32-200408181430), the extra
"From:" header does not seem to work.

test.php:
<?php
mail('[EMAIL PROTECTED]','subject','body',"From: [EMAIL PROTECTED]");
?>

Warning: mail(): "sendmail_from" not set in php.ini or custom "From:"
header missing in C:\dev\quiktests\test.php on line 3

------------------------------------------------------------------------

[2004-08-06 21:39:27] kdaniel at aosepc dot com

I don't see how that is possible because there is no way for the mail
server to pick up the sendmail_from ini setting.  PHP has to be using
it somewhere.  There needs to be a way to disable its use.

------------------------------------------------------------------------

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/28976

-- 
Edit this bug report at http://bugs.php.net/?id=28976&edit=1

Reply via email to