summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHartmut Holzgraefe <hholzgra@php.net>2000-06-27 16:15:16 +0000
committerHartmut Holzgraefe <hholzgra@php.net>2000-06-27 16:15:16 +0000
commit6f2843fa20a15b81a36cb1a27d419d83f768447d (patch)
treec0d40027841510b9d71de22da88a9d325d3942df
parent9322b9d9a545e0519ef2a4e7de07ede77de854ed (diff)
downloadphp-git-6f2843fa20a15b81a36cb1a27d419d83f768447d.tar.gz
should now get multiple To: and Cc: recievers right
(code taken from php3 version)
-rw-r--r--win32/sendmail.c42
1 files changed, 30 insertions, 12 deletions
diff --git a/win32/sendmail.c b/win32/sendmail.c
index 527c17fa05..fa7203d993 100644
--- a/win32/sendmail.c
+++ b/win32/sendmail.c
@@ -214,7 +214,7 @@ int SendText(char *RPath, char *Subject, char *mailTo, char *data, char *headers
if (strchr(mailTo, '@') == NULL)
return (BAD_MSG_DESTINATION);
- sprintf(Buffer, "HELO %s\n", LocalHost);
+ sprintf(Buffer, "HELO %s\r\n", LocalHost);
/* in the beggining of the dialog */
/* attempt reconnect if the first Post fail */
@@ -226,20 +226,38 @@ int SendText(char *RPath, char *Subject, char *mailTo, char *data, char *headers
if ((res = Ack()) != SUCCESS)
return (res);
- sprintf(Buffer, "MAIL FROM:<%s>\n", RPath);
- if ((res = Post(Buffer)) != SUCCESS)
- return (res);
- if ((res = Ack()) != SUCCESS)
- return (res);
+ // Send mail to all rcpt's
+ token = strtok(tempMailTo, ",");
+ while(token != NULL)
+ {
+ sprintf(Buffer, "RCPT TO:<%s>\r\n", token);
+ if ((res = Post(Buffer)) != SUCCESS)
+ return (res);
+ if ((res = Ack()) != SUCCESS)
+ return (res);
+ token = strtok(NULL, ",");
+ }
+ // Send mail to all Cc rcpt's
+ efree(tempMailTo);
+ if (headers && pos1 = strstr(headers, "Cc:")) {
+ pos2 = strstr(pos1, "\r\n");
+ tempMailTo = estrndup(pos1, pos2-pos1);
- sprintf(Buffer, "RCPT TO:<%s>\n", mailTo);
- if ((res = Post(Buffer)) != SUCCESS)
- return (res);
- if ((res = Ack()) != SUCCESS)
- return (res);
+ token = strtok(tempMailTo, ",");
+ while(token != NULL)
+ {
+ sprintf(Buffer, "RCPT TO:<%s>\r\n", token);
+ if ((res = Post(Buffer)) != SUCCESS)
+ return (res);
+ if ((res = Ack()) != SUCCESS)
+ return (res);
+ token = strtok(NULL, ",");
+ }
+ efree(tempMailTo);
+ }
- if ((res = Post("DATA\n")) != SUCCESS)
+ if ((res = Post("DATA\r\n")) != SUCCESS)
return (res);
if ((res = Ack()) != SUCCESS)
return (res);