[PHP-DEV] [PATCH] Bug #14407: Win32 SendMail function doesn't use From: in SMTP MAIL FROM command

2002-05-14 Thread Michael Sisolak

Diff against current HEAD for patch for bug #14407.  This allows the
return path to automatically be set to the from address for Win32
sendmail.

Michael Sisolak
[EMAIL PROTECTED]

__
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com

--- sendmail.c  Tue May 14 10:07:40 2002
+++ sendmail.c.new  Tue May 14 10:22:13 2002
@@ -125,11 +125,26 @@
strcpy(MailHost, host);
}
 
-   if (INI_STR(sendmail_from)){
-   RPath = estrdup(INI_STR(sendmail_from));
+   /* use from address as return path (if specified in headers) */
+   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 {
*error = W32_SM_SENDMAIL_FROM_NOT_SET;
return FAILURE;
+   }
}
 
/* attempt to connect with mail host */



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DEV] [PATCH] Bug #14407: Win32 SendMail function doesn't use From: in SMTP MAIL FROM command

2002-05-14 Thread Markus Fischer

Hi,

thanks for your quick repsonse. I've applied your patch with
a few changes.

- Markus

On Tue, May 14, 2002 at 07:27:39AM -0700, Michael Sisolak wrote : 
 Diff against current HEAD for patch for bug #14407.  This allows the
 return path to automatically be set to the from address for Win32
 sendmail.
 
 Michael Sisolak
 [EMAIL PROTECTED]
 
 __
 Do You Yahoo!?
 LAUNCH - Your Yahoo! Music Experience
 http://launch.yahoo.com
Content-Description: sendmail.c.diff
 --- sendmail.cTue May 14 10:07:40 2002
 +++ sendmail.c.newTue May 14 10:22:13 2002
 @@ -125,11 +125,26 @@
   strcpy(MailHost, host);
   }
  
 - if (INI_STR(sendmail_from)){
 - RPath = estrdup(INI_STR(sendmail_from));
 + /* use from address as return path (if specified in headers) */
 + 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 {
   *error = W32_SM_SENDMAIL_FROM_NOT_SET;
   return FAILURE;
 + }
   }
  
   /* attempt to connect with mail host */
 

 -- 
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
Please always Cc to me when replying to me on the lists.
GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
-
I mean When in doubt, blame mcrypt is more often right than wrong :)
Always right, never wrong :)
- Two PHP developers who want to remain unnamed

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php