Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12251 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90069 invoked by uid 1010); 19 Aug 2004 06:12:43 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 89827 invoked from network); 19 Aug 2004 06:12:42 -0000 Received: from unknown (HELO moray.dnsvelocity.com) (64.21.80.13) by pb1.pair.com with SMTP; 19 Aug 2004 06:12:42 -0000 Received: from nobody by moray.dnsvelocity.com with local (Exim 4.34) id 1BxgAC-0007qw-Pk; Thu, 19 Aug 2004 06:12:40 +0000 Received: from 24.243.250.112 (SquirrelMail authenticated user dv@josheli.com); by mail.josheli.com with HTTP; Thu, 19 Aug 2004 01:12:40 -0500 (CDT) Message-ID: <4775.24.243.250.112.1092895960.squirrel@24.243.250.112> In-Reply-To: <10928707020000000@9866357972520000.9866341568840000> References: <10928707020000000@9866357972520000.9866341568840000> Date: Thu, 19 Aug 2004 01:12:40 -0500 (CDT) To: "Frank M. Kromann" Cc: internals@lists.php.net Reply-To: dv@josheli.com User-Agent: SquirrelMail/1.4.3a X-Mailer: SquirrelMail/1.4.3a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - moray.dnsvelocity.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [99 99] / [47 12] X-AntiAbuse: Sender Address Domain - josheli.com X-Source: X-Source-Args: X-Source-Dir: Subject: Re: [PHP-DEV] mail() on windows From: dv@josheli.com ("David Vance") ok thanks. but still, how is it that mail('example@php.com','subject','body',"From: me@example.com\r\n"); should produce an error message stating "custom "From:" header missing"? and is there any reason the custom header can't be parsed, and if a "From:" header is found, to use that instead of sendmail_from value? thanks again. On Wed, August 18, 2004 6:11 pm, Frank M. Kromann said: > > These extra parameters to the TSendMail function are used by imap_mail(). > To use this function you need to load the imap extension but you get a few > more options that are not available in the standard mail function. See > http://php.net/imap_mail for more information. > > - Frank > > >> sorry in advance for the length, formatting and possible redundancy of >> this message. >> >> Anyway, on Windows, leaving "sendmail_from" blank and setting a "From:" >> header in the extra headers parameter doesn't work. >> >> test.php: >> > mail('example@php.com','subject','body',"From: me@example.com\r\n"); >> /* >> Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" >> header missing in C:\dev\quiktests\test.php on line 3 >> */ >> >> ??--> http://bugs.php.net/bug.php?id=28976 >> there are also a couple user notes on the mail manual page to the > effect >> of "use ini_set()", but that seems messy, especially for distributed >> scripts to do a check everytime they send mail(): >> if(PHP_OS == 'Win' && empty(ini_get("sendmail_from")){ >> ini_set("sendmail_from", $tempFromAddress); >> } >> >> >> I don't know C (or any cvs/patch tools), but here's what I think is > going on: >> >> in ext/standard/mail.c we find the following code (notice the last >> argument to TSendMail() is NULL): >> >> [code] >> .... >> PHPAPI int php_mail(char *to, char *subject, char *message, char > *headers, >> char *extra_cmd TSRMLS_DC) { >> ..... >> if (!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) == FAILURE) { >> .... >> [/code] >> >> >> unfortunately, in win32/sendmail.c we find this: >> >> [code] >> .... >> PHPAPI int TSendMail(char *host, int *error, char **error_message, >> char *headers, char *Subject, char *mailTo, char *data, >> char *mailCc, char *mailBcc, char *mailRPath) >> { >> .... >> /* 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; >> } >> .... >> [/code] >> >> it seems mailRPath will always be NULL and "sendmail_from" will always > be >> "fallen back" to, and thus you get an error. >> >> maybe, probably, i'm missing something, but at the very least, the > error >> message ("custom "From:" header missing") or the documentation could be >> altered. >> >> thanks. >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > > >