fmk             Sat Nov 30 16:50:17 2002 EDT

  Modified files:              
    /php4/win32 sendmail.c 
  Log:
  Dont scan headers for cc abd bcc if extra parameters are used for these
  
  
Index: php4/win32/sendmail.c
diff -u php4/win32/sendmail.c:1.47 php4/win32/sendmail.c:1.48
--- php4/win32/sendmail.c:1.47  Sat Sep 21 11:03:24 2002
+++ php4/win32/sendmail.c       Sat Nov 30 16:50:17 2002
@@ -17,7 +17,7 @@
  *
  */
 
-/* $Id: sendmail.c,v 1.47 2002/09/21 15:03:24 mfischer Exp $ */
+/* $Id: sendmail.c,v 1.48 2002/11/30 21:50:17 fmk Exp $ */
 
 #include "php.h"                               /*php specific */
 #include <stdio.h>
@@ -414,8 +414,28 @@
        }
        efree(tempMailTo);
 
+       if (mailCc && *mailCc) {
+               tempMailTo = estrdup(mailCc);
+               /* Send mail to all rcpt's */
+               token = strtok(tempMailTo, ",");
+               while(token != NULL)
+               {
+                       snprintf(Buffer, MAIL_BUFFER_SIZE, "RCPT TO:<%s>\r\n", token);
+                       if ((res = Post(Buffer)) != SUCCESS) {
+                               efree(tempMailTo);
+                               return (res);
+                       }
+                       if ((res = Ack(&server_response)) != SUCCESS) {
+                               SMTP_ERROR_RESPONSE(server_response);
+                               efree(tempMailTo);
+                               return (res);
+                       }
+                       token = strtok(NULL, ",");
+               }
+               efree(tempMailTo);
+       }
        /* Send mail to all Cc rcpt's */
-       if (headers && (pos1 = strstr(headers_lc, "cc:"))) {
+       else if (headers && (pos1 = strstr(headers_lc, "cc:"))) {
                /* Real offset is memaddress from the original headers + difference of
                 * string found in the lowercase headrs + 3 characters to jump over
                 * the cc: */
@@ -444,8 +464,11 @@
                efree(tempMailTo);
        }
 
-       if (mailCc && *mailCc) {
-               tempMailTo = estrdup(mailCc);
+       /* Send mail to all Bcc rcpt's
+          This is basically a rip of the Cc code above.
+          Just don't forget to remove the Bcc: from the header afterwards. */
+       if (mailBcc && *mailBcc) {
+               tempMailTo = estrdup(mailBcc);
                /* Send mail to all rcpt's */
                token = strtok(tempMailTo, ",");
                while(token != NULL)
@@ -464,11 +487,7 @@
                }
                efree(tempMailTo);
        }
-
-       /* Send mail to all Bcc rcpt's
-          This is basically a rip of the Cc code above.
-          Just don't forget to remove the Bcc: from the header afterwards. */
-       if (headers) {
+       else if (headers) {
                if (pos1 = strstr(headers_lc, "bcc:")) {
                        /* Real offset is memaddress from the original headers + 
difference of
                         * string found in the lowercase headrs + 4 characters to jump 
over
@@ -524,27 +543,6 @@
                                return OUT_OF_MEMORY;
                        }
                }
-       }
-
-       if (mailBcc && *mailBcc) {
-               tempMailTo = estrdup(mailBcc);
-               /* Send mail to all rcpt's */
-               token = strtok(tempMailTo, ",");
-               while(token != NULL)
-               {
-                       snprintf(Buffer, MAIL_BUFFER_SIZE, "RCPT TO:<%s>\r\n", token);
-                       if ((res = Post(Buffer)) != SUCCESS) {
-                               efree(tempMailTo);
-                               return (res);
-                       }
-                       if ((res = Ack(&server_response)) != SUCCESS) {
-                               SMTP_ERROR_RESPONSE(server_response);
-                               efree(tempMailTo);
-                               return (res);
-                       }
-                       token = strtok(NULL, ",");
-               }
-               efree(tempMailTo);
        }
 
        if ((res = Post("DATA\r\n")) != SUCCESS) {



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

Reply via email to