--- autorespond.c.orig	2008-09-30 11:29:22.000000000 +0000
+++ autorespond.c	2008-09-30 19:47:59.000000000 +0000
@@ -523,6 +523,7 @@
 char buffer[256];
 char *content_boundary;
 char *rpath = DEFAULT_FROM;
+char *rfrom;
 char *TheUser;
 char *TheDomain;
 
@@ -573,6 +574,26 @@
 		strncat( rpath, TheDomain, strlen(TheDomain) );
 	}
 
+	rfrom = safe_malloc(strlen(rpath) + 1);
+	strncpy(rfrom, rpath, strlen(rpath));
+
+	/* IN : rpath = "Foo Bar <foo@example.com>"
+	 * OUT: rpath = "foo@example.com"
+	 */
+	if ( strrchr(rpath, '<') && strrchr(rpath, '>') ) {
+		char * tmpFrom = safe_malloc( strlen(rpath) );
+		strncpy(tmpFrom, rpath, strlen(rpath));
+
+		char * pch;
+		pch = strtok(tmpFrom, "<>");
+		pch = strtok(NULL, "<>");
+		free(rpath);
+		rpath = safe_malloc( strlen(pch) + 1 );
+		strncpy(rpath, pch, strlen(pch));
+		rpath[strlen(rpath)] = '\0';
+		free(tmpFrom);
+	}
+
 	timer = time(NULL);
 
 	/*prepare the "delivered-to" string*/
@@ -674,7 +695,7 @@
 	f = fopen(filename,"wb"); 
 
 	fprintf( f, "%sTo: %s\nFrom: %s\nSubject: Re:%s\n%s\n", 
-	            my_delivered_to, sender, rpath, inspect_headers( "Subject", (char *) NULL ), message );
+	            my_delivered_to, sender, rfrom, inspect_headers( "Subject", (char *) NULL ), message );
 
 	if ( message_handling == 1 ) {
 		fprintf( f, "%s\n\n", "-------- Original Message --------" );
