Change in "From" line

Since upgrading from 2.0.11 to 2.0.14, my “From” lines look like this:From: “” address@example.com " via RT" queue@mydomain.com

before they looked much better:

From: address@example.com via RT queue@mydomain.com

What’s the reasoning behind all the added quotes?

This happens with both the “sendmail” and “sendmailpipe” sending
methods.

Or could this be related to perl’s MailTools 1.48 package?

Vivek Khera, Ph.D. Khera Communications, Inc.
Internet: khera@kciLink.com Rockville, MD +1-240-453-8497
AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/

Since upgrading from 2.0.11 to 2.0.14, my “From” lines look like this:

From: “” address@example.com " via RT" queue@mydomain.com

before they looked much better:

From: address@example.com via RT queue@mydomain.com

What’s the reasoning behind all the added quotes?

Well, your “much better” example will break the MTA. :slight_smile: 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@lafferty.ca -----------±----------------------------------------------

rt-2.0.13-email-quotes.patch (967 Bytes)

“RL” == Rich Lafferty rich+rt@lafferty.ca writes:

Since upgrading from 2.0.11 to 2.0.14, my “From” lines look like this:

From: “” address@example.com " via RT" queue@mydomain.com

before they looked much better:

From: address@example.com via RT queue@mydomain.com

What’s the reasoning behind all the added quotes?

RL> Well, your “much better” example will break the MTA. :slight_smile: That’s not an
RL> email address in front, it’s a realname. (It will also break with
RL> commas, etc.)

Well, no, it won’t make a bit of difference given the way it is quoted
now. The realname part is outside of a quoted environment.

Seems to me the better way would be to put the realname part in the
comments section of the address and format it like this:

and just protect parens in the friendly name part.

btw: your patch doesn’t apply to 2.0.14 cleanly.

RL> Well, your “much better” example will break the MTA. :slight_smile: That’s not an
RL> email address in front, it’s a realname. (It will also break with
RL> commas, etc.)

Well, no, it won’t make a bit of difference given the way it is quoted
now. The realname part is outside of a quoted environment.

Yep, it will. Try a realname with an email address and a comma – or
worse, with a lone double-quote in it. I’ve no idea what a “quoted
environment” is in an address, and neither does 2822, so I don’t know
what the last sentence means.

But yes, the way that it is quoted now also breaks. But the idea of
fixing it is to make it work, not make it break differently. :slight_smile:

You can either evaluate whether or not it needs to be quoted, or you
can blindly quote. Blindly quote is easier, so there it is. Of course,
no-one is forcing you to apply it – if you think it should be done
some other way, you’re welcome to write that instead. :slight_smile:

(I find addr (name)'' to be ugly compared toname
’’. Important things go first if you read left to right.)

btw: your patch doesn’t apply to 2.0.14 cleanly.

Quite possibly, but the changes are trivial – try using vpatch
instead. :slight_smile: It’s only five new lines, and only three of them are
code.

One thing I forgot to mention (thanks, Jesse :slight_smile: is that my patch
doesn’t make things prettier for addresses already in the database
that have quotes around them, although it guarantees they’ll be legal.
I also removed all of the quotes around addresses in the DB when I
applied it.

-Rich

Rich Lafferty --------------±----------------------------------------------
Ottawa, Ontario, Canada | Save the Pacific Northwest Tree Octopus!
http://www.lafferty.ca/ | http://zapatopi.net/treeoctopus.html
rich@lafferty.ca -----------±----------------------------------------------

“RL” == Rich Lafferty rich+rt@lafferty.ca writes:

RL> But yes, the way that it is quoted now also breaks. But the idea of
RL> fixing it is to make it work, not make it break differently. :slight_smile:

Yes, fixing it so the quoting is done right will solve the problem.
But as it stands, the quoting is way wrong, leaving the part that
was supposed to be protected outside of quotes.

RL> Quite possibly, but the changes are trivial – try using vpatch
RL> instead. :slight_smile: It’s only five new lines, and only three of them are
RL> code.

The quoting code is quite different. It is not a matter of line or
space fuzz. I’ll take a stab at it shortly.

Rich Lafferty wrote:

From: “” address@example.com " via RT" queue@mydomain.com
before they looked much better:
From: address@example.com via RT queue@mydomain.com

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

Actually, the code in SendEmail.pm to deal with quotes looks
decidedly bogus to me.

The sanitisation of $friendly_name around line 290 in particular
seems to
a) be within an inappropriate conditional, and
b) add quotes that should not be there.

Possible patch attached.
Phil Homewood, Systems Janitor, www.SnapGear.com
pdh@snapgear.com Ph: +61 7 3435 2810 Fx: +61 7 3891 3630
SnapGear - Custom Embedded Solutions and Security Appliances

SendEmail.patch (802 Bytes)

“PH” == Phil Homewood pdh@snapgear.com writes:

PH> Actually, the code in SendEmail.pm to deal with quotes looks
PH> decidedly bogus to me.

PH> The sanitisation of $friendly_name around line 290 in particular
PH> seems to
PH> a) be within an inappropriate conditional, and
PH> b) add quotes that should not be there.

I concur with this patch. It appears to DTRT.

“VK” == Vivek Khera khera@kcilink.com writes:

VK> I concur with this patch. It appears to DTRT.

There also appears to be a need to protect $friendly_name in
Action/Autoreply.pm, method SetReturnAddress().

Vivek Khera wrote:

There also appears to be a need to protect $friendly_name in
Action/Autoreply.pm, method SetReturnAddress().

$friendly_name in that case is the queue name as set by the
RT administrator; however I agree that it probably should
be protected to avoid a call to $RT::Owner->shoot($self->foot).

A simple

$friendly_name =~ s/"/\"/g;

right before the SetHeader() around line 53 should do it.
Phil Homewood, Systems Janitor, www.SnapGear.com
pdh@snapgear.com Ph: +61 7 3435 2810 Fx: +61 7 3891 3630
SnapGear - Custom Embedded Solutions and Security Appliances