HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] Hylafax Not Utilizing All of X-Fax-* Metaheaders



Davie Lynn wrote:

When I submit a fax using sendmail to the hylafax fax to e-mail gateway, I typically construct my e-mail like this:

   To: joe@xxxxxxxxxxx (Joe Schmo)
   X-Fax-To: Joe Schmo
   X-Fax-From: Me

Hylafax will utilize the sender information from the "X-Fax-From" header in the cover page.
However, insteading of pulling the recipient's name from the "X-Fax-To" header or retrieving it from the comment as indicated by parentheses, it just puts whatever is the the left of the @ sign in the "To:" header.


The header format of...

tag: value (comment)

is used when a mail client puts the written name of the person within parenthesis. RFC822 states that the text within parenthesis are comments. More properly the written name should be given in the more-common format of:

To: "Joe Schmo" <joe@xxxxxxxxxxx>

In fact, to further the reason why the parenthetical format is troublesome... this is completely acceptable:

To: "Joe Schmo" <joe@xxxxxxxxxxx> (Joe's fax)

In any case, the attached patch will enable the proper functionality of the X-Fax-To header.

Thanks,

Lee.
diff -Nru hylafax.orig/faxmail/faxmail.c++ hylafax/faxmail/faxmail.c++
--- hylafax.orig/faxmail/faxmail.c++	2007-08-31 18:00:50.000000000 -0700
+++ hylafax/faxmail/faxmail.c++	2007-09-01 17:16:28.259898360 -0700
@@ -324,7 +324,7 @@
 	    /*
 	     * Likewise for the receipient name.
 	     */
-	    if (job->getCoverName() == "" && (s = findHeader("to"))) {
+	    if (job->getCoverName() == "" && ((s = findHeader("x-fax-to")) || (s = findHeader("to")))) {
 		/*
 		 * Try to extract a user name from the to information.
 		 */
@@ -333,7 +333,7 @@
 		u_int tl = to.length();
 		if (l == tl) {
 		    l = to.next(0, '(');
-		    if (l != tl)		// joe@foobar (Joe Schmo)
+		    if (l != tl)		// joe@foobar (Joe Schmo), no longer works due to RFC822 compliance in parseHeaders (in-parenthesis are stripped as comments)
 			l++, to = to.token(l, ')');
 		    else {			// joe@foobar
 			l = to.next(0, '@');
@@ -343,9 +343,9 @@
 		} else {			// Joe Schmo <joe@foobar>
 		    to = to.head(l);
 		}
-		// strip any leading&trailing white space
-		to.remove(0, to.skip(0, " \t"));
-		to.resize(to.skipR(to.length(), " \t"));
+		// strip any leading&trailing white space or double-quotes
+		to.remove(0, to.skip(0, " \t\""));
+		to.resize(to.skipR(to.length(), " \t\""));
 		job->setCoverName(to);
 	    }
 	}
diff -Nru hylafax.orig/util/SendFaxClient.h hylafax/util/SendFaxClient.h
--- hylafax.orig/util/SendFaxClient.h	2007-08-31 18:00:48.000000000 -0700
+++ hylafax/util/SendFaxClient.h	2007-09-01 17:23:26.762276328 -0700
@@ -178,7 +178,6 @@
 };
 
 inline SendFaxJob& SendFaxClient::getProtoJob()	{ return proto; }
-inline const fxStr& SendFaxClient::getFromIdentity() const { return from; }
 inline const fxStr& SendFaxClient::getSenderName() const { return senderName;}
 inline void SendFaxClient::setVerbose(bool b) { verbose = b; }
 inline bool SendFaxClient::getVerbose() const { return verbose; }



Project hosted by iFAX Solutions