[rt-users] change in "From" line

Rich Lafferty rich+rt at lafferty.ca
Fri Aug 9 14:57:42 EDT 2002


On Fri, Aug 09, 2002 at 02:47:31PM -0400, Vivek Khera <khera at kcilink.com> wrote:
> Since upgrading from 2.0.11 to 2.0.14, my "From" lines look like this:
> 
>  From: "" address at example.com " via RT" <queue at mydomain.com>
> 
> before they looked much better:
> 
>  From: address at example.com via RT <queue at mydomain.com>
> 
> What's the reasoning behind all the added quotes?

Well, your "much better" example will break the MTA. :-) That's not an
email address in front, it's a realname. (It will also break with
commas, etc.)

IIRC, the inside set of quotes is from the original email, extracted
by RT::Interface::Email on the way in. The outside set of quotes is
from RT::Action::SendEmail on the way out.

Both are probably unnecessary, but one is necessary. I decided we
should always have quotes on outgoing messages to take care of RFC
2822 compliance, but not store quotes in RT's database in the Real
Name field when they've been added to incoming mail because of RFC
2822 compliance. Patch against my 2.0.13 install appended.

  -Rich

-- 
Rich Lafferty --------------+-----------------------------------------------
 Ottawa, Ontario, Canada    |  Save the Pacific Northwest Tree Octopus!
 http://www.lafferty.ca/    |    http://zapatopi.net/treeoctopus.html
rich at lafferty.ca -----------+-----------------------------------------------
-------------- next part --------------
--- rt2-orig/lib/RT/Action/SendEmail.pm	Fri Jul 12 10:31:20 2002
+++ rt2-esmith/lib/RT/Action/SendEmail.pm	Fri Jul 12 12:12:55 2002
@@ -291,6 +291,7 @@
     
   unless ($self->TemplateObj->MIMEObj->head->get('From')) {
       my $friendly_name=$self->TransactionObj->CreatorObj->RealName;
+      $friendly_name =~ s/"/\\"/g;
       # TODO: this "via RT" should really be site-configurable.
       $self->SetHeader('From', "\"$friendly_name via RT\" <$replyto>");
   }
--- rt2-orig/lib/RT/Interface/Email.pm	Fri Jul 12 12:07:46 2002
+++ rt2-esmith/rt2/lib/RT/Interface/Email.pm	Fri Jul 12 12:24:23 2002
@@ -336,6 +336,10 @@
 
     #Suck the address of the sender out of the header
     my ($Address, $Name) = ParseSenderAddressFromHead($head);
+
+    # Incoming mail address may have quotes around name part
+    $Name =~ s/^"//;
+    $Name =~ s/"$//;
     
     #This will apply local address canonicalization rules
     $Address = RT::CanonicalizeAddress($Address);


More information about the rt-users mailing list