cvs: /php3/win32 sendmail.c

From: Date: Wed, 01 Sep 1999 10:14:02 +0000
Subject: cvs: /php3/win32 sendmail.c
Groups: php.dev 
Request: Send a blank email to php-dev+get-10406@lists.php.net to get a copy of this message
fmk Wed Sep 1 06:14:02 1999 EDT Modified files: /php3/win32 sendmail.c Log: Allow multiple mail recpt's in To: and Cc: headers Index: php3/win32/sendmail.c diff -u php3/win32/sendmail.c:1.25 php3/win32/sendmail.c:1.26 --- php3/win32/sendmail.c:1.25 Tue Jun 29 14:50:16 1999 +++ php3/win32/sendmail.c Wed Sep 1 06:14:02 1999 @@ -1,4 +1,4 @@ -/* $Id: sendmail.c,v 1.25 1999/06/29 18:50:16 jim Exp $ */ +/* $Id: sendmail.c,v 1.26 1999/09/01 10:14:02 fmk Exp $ */ /* * PHP Sendmail for Windows. @@ -206,6 +206,7 @@ int res, i; char *p; + char *tempMailTo, *token, *pos1, *pos2; TLS_VARS; // check for NULL parameters @@ -239,8 +240,31 @@ if ((res = Ack()) != SUCCESS) return (res); + tempMailTo = estrdup(mailTo); + + // Send mail to all rcpt's + token = strtok(tempMailTo, ","); + while(token != NULL) + { + sprintf(GLOBAL(Buffer), "RCPT TO:<%s>\r\n", token); + token = strtok(NULL, ","); + } - sprintf(GLOBAL(Buffer), "RCPT TO:<%s>\r\n", mailTo); + // Send mail to all Cc rcpt's + efree(tempMailTo); + if (pos1 = strstr(headers, "Cc:")) { + pos2 = strstr(pos1, "\r\n"); + tempMailTo = estrndup(pos1, pos2-pos1); + + token = strtok(tempMailTo, ","); + while(token != NULL) + { + sprintf(GLOBAL(Buffer), "RCPT TO:<%s>\r\n", token); + token = strtok(NULL, ","); + } + efree(tempMailTo); + } + if ((res = Post(GLOBAL(Buffer))) != SUCCESS) return (res); if ((res = Ack()) != SUCCESS) @@ -343,7 +367,9 @@ p += sprintf(p, "From: %s\r\n", RPath); } p += sprintf(p, "Subject: %s\r\n", Subject); - p += sprintf(p, "To: %s\r\n", mailTo); + if(!xheaders || !strstr(xheaders, "To:")){ + p += sprintf(p, "To: %s\r\n", mailTo); + } if(xheaders){ p += sprintf(p, "%s\r\n", xheaders); }

« previous php.dev (#10406) next »