Fix for Bug #7068
| From: | Sean R. Bright | Date: | Thu, 01 Feb 2001 19:36:28 +0000 |
| Subject: | Fix for Bug #7068 | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-45553@lists.php.net to get a copy of this message | ||
If there is no objection to this bandaid to fix bug #7068
(http://bugs.php.net/bugs.php?id=7068) then I will go ahead and apply it.
I think the Win32 smtp code needs somewhat of an overhaul in order to
properly handle email addresses of the form:
"Some User, Jr." <user@somesite.org>
Right now, it uses the "," as a delimeter, even though its inside a literal.
This patch addresses the issue of a user passing an address in with
surrounding <>'s.
Index: win32/sendmail.c
===================================================================
RCS file: /repository/php4/win32/sendmail.c,v
retrieving revision 1.20
diff -u -u -r1.20 sendmail.c
--- win32/sendmail.c 2000/09/05 00:26:15 1.20
+++ win32/sendmail.c 2001/02/01 19:35:18
@@ -242,7 +242,11 @@
token = strtok(tempMailTo, ",");
while(token != NULL)
{
- sprintf(Buffer, "RCPT TO:<%s>\r\n", token);
+ if (strchr(token,'<') && strchr(token,'>'))
+ sprintf(Buffer, "RCPT TO:%s\r\n", token);
+ else
+ sprintf(Buffer, "RCPT TO:<%s>\r\n", token);
+
if ((res = Post(Buffer)) != SUCCESS)
return (res);
if ((res = Ack()) != SUCCESS)
@@ -259,7 +263,11 @@
token = strtok(tempMailTo, ",");
while(token != NULL)
{
- sprintf(Buffer, "RCPT TO:<%s>\r\n", token);
+ if (strchr(token,'<') &&
strchr(token,'>'))
+ sprintf(Buffer, "RCPT TO:%s\r\n", token);
+ else
+ sprintf(Buffer, "RCPT TO:<%s>\r\n", token);
+
if ((res = Post(Buffer)) != SUCCESS)
return (res);
if ((res = Ack()) != SUCCESS)
--
===================================================================
Sean Bright
elixer@erols.com / sean@seanbright.com / http://www.seanbright.com/
===================================================================