From: Frank M. Kromann Date: Sat, 30 Nov 2002 21:50:17 +0000 (+0000) Subject: Dont scan headers for cc abd bcc if extra parameters are used for these X-Git-Tag: RELEASE_1_0b3~243 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=32d7284c52ff12549e5aef5b0a114cd9803c174a;p=php Dont scan headers for cc abd bcc if extra parameters are used for these --- diff --git a/win32/sendmail.c b/win32/sendmail.c index 8e4581595e..d98ce3c768 100644 --- a/win32/sendmail.c +++ b/win32/sendmail.c @@ -414,8 +414,28 @@ int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char *mailB } 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 @@ int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char *mailB 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 @@ int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char *mailB } 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 @@ -526,27 +545,6 @@ int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char *mailB } } - 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) { efree(stripped_header); return (res);