]> granicus.if.org Git - php/commitdiff
- Only add the To: field with the $to parameter if we don't have it in the
authorMarkus Fischer <mfischer@php.net>
Sun, 2 Jun 2002 23:39:59 +0000 (23:39 +0000)
committerMarkus Fischer <mfischer@php.net>
Sun, 2 Jun 2002 23:39:59 +0000 (23:39 +0000)
  custom header. This was the behaviour < 4.2.x (but it was broken, this one
  isn't).
# last commit for today, promised.

win32/sendmail.c

index 28d26d23d0fcb84b5929c028bcc168234ab8c4a2..4266aa750958ba7927d5fb04d625496461fb8e95 100644 (file)
@@ -545,9 +545,14 @@ int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders, char *m
        if (!addToHeader(&header_buffer, "Subject: %s\r\n", Subject)) {
                goto PostHeader_outofmem;
        }
-       if (!addToHeader(&header_buffer, "To: %s\r\n", mailTo)) {
-               goto PostHeader_outofmem;
+
+       /* Only add the To: field from the $to parameter if isn't in the custom headers */
+       if ((headers_lc && (!strstr(headers_lc, "\r\nto:") && (strncmp(headers_lc, "to:", 3) != 0))) || !headers_lc) {
+               if (!addToHeader(&header_buffer, "To: %s\r\n", mailTo)) {
+                       goto PostHeader_outofmem;
+               }
        }
+
        if (mailCc && *mailCc) {
                if (!addToHeader(&header_buffer, "Cc: %s\r\n", mailCc)) {
                goto PostHeader_outofmem;