Bug #14407 Updated: Win32 SendMail function doesn't use "From:" in SMTP MAIL FROM command

From: Date: Sun, 02 Jun 2002 22:55:46 +0000
Subject: Bug #14407 Updated: Win32 SendMail function doesn't use "From:" in SMTP MAIL FROM command
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-9241@lists.php.net to get a copy of this message
 ID:               14407
 Updated by:       mfischer@php.net
 Reported By:      msisolak@yahoo.com
 Status:           Closed
 Bug Type:         Mail related
 Operating System: Windows 2000
 PHP Version:      4.0CVS-2001-12-10
 New Comment:

I've reverted the patch. The sendmail_from ini setting is for setting
the return path, which can be different from the From: header in fact.


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

[2002-05-17 12:30:34] mfischer@php.net

Fixed in CVS.

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

[2002-05-14 10:02:19] mfischer@php.net

Can you post a unified diff against latest CVS HEAD to
php-dev@lists.php.net please ?

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

[2001-12-10 12:27:12] msisolak@yahoo.com

The SendMail function that is used for Win32 platforms doesn't extract
the "From:" header address to use as for the SMTP MAIL FROM command. 
As a result any mail bounces go to the "sendmail_from" php.ini option
instead of to the sender.  This is handled correctly in the PostHeader
function (which doesn't add "From:" if it is already there), but not in
TSendMail.  The patch for win32/sendmail.c below allows TSendMail to
use the e-mail from address if it is available, and default to the
sendmail_from setting otherwise.

124,128c124,142
< 
< 	if (INI_STR("sendmail_from")){
< 		RPath = estrdup(INI_STR("sendmail_from"));
< 		} else {
< 			return 19;
---
> 
> 	if (headers && strstr(headers, "From:")) {
> 		char *pos;
> 		pos = strstr(headers, "From:") + 5;
> 		while (pos && (*pos == ' '))
> 			pos++;
> 
> 		if (pos && strlen(pos)) {
> 			RPath = estrdup(pos);
> 			RPath[strcspn(RPath, "\r\n")] = '\x0';
> 		}
> 	}
> 	
> 	if (!RPath) {
> 		if (INI_STR("sendmail_from")) {
> 			RPath = estrdup(INI_STR("sendmail_from"));
> 			} else {
> 				return 19;
> 		}

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


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



Thread (1 message)

  • mfischer@php.net
  • Unknown Message
    • mfischer@php.net
« previous php.bugs (#9241) next »