packages/net/mini_sendmail/patches/200-fullname.patch
florian 69cd8303d9 Fix full name support, thanks zandbelt (#1578)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@6919 3c298f89-4303-0410-b956-a3cf2f4a3e73
2007-04-10 10:36:51 +00:00

35 lines
943 B
Diff

--- mini_sendmail-1.3.5.org/mini_sendmail.c 2003-11-17 03:03:35.000000000 +0100
+++ mini_sendmail-1.3.5/mini_sendmail.c 2007-04-08 19:46:42.000000000 +0200
@@ -539,6 +539,7 @@
}
/* Strip off any angle brackets. */
+/*
while ( len > 0 && *recipient == '<' )
{
++recipient;
@@ -548,6 +549,23 @@
--len;
(void) snprintf( buf, sizeof(buf), "RCPT TO:<%.*s>", len, recipient );
+*/
+ if (len > 0 && recipient[len-1] == '>' )
+ {
+ /* "<name@domain>" or: "Full Name <name@domain>" */
+ while (len > 0 && *recipient != '<' )
+ {
+ ++recipient;
+ --len;
+ }
+ (void) snprintf( buf, sizeof(buf), "RCPT TO:%.*s", len, recipient );
+ }
+ else
+ {
+ /* name@domain */
+ (void) snprintf( buf, sizeof(buf), "RCPT TO:<%.*s>", len, recipient );
+ }
+
send_command( buf );
status = read_response();
if ( status != 250 && status != 251 )