Issue Bug Closed

#23955from_name should be quoted (at least when it's an e-mail address)

Joost van Beurden 11/05/10, 15:39 updated 02/07/14, 12:35

Description

I ran into this issue when the from address of e-mails sent by tx_powermail where rewritten by MS Exchange.
The from address name@domain.com appears as:

name@ [domain.com name@domain.com]

This problem only occured when sending to an Exchange server. Mailboxes behind a postfix or qmail server didn’t suffer from this issue. At this point, your conclusion could be that it’s an Echange issue but I think otherwise.

After a few debugging sessions I found out that this issue triggered by the ‘From:’ header being formatted like this:

name@domain.com <name></name>

I’ve read the different RFC’s about e-mail address formatting, as far as I was able to understand them.

In RFC terminology this is: display-name <addr-spec></addr-spec>

If you follow the rules, an e-mail address is not allowed as the display-name because of the ‘@’ sign. In that case the display-name should be quoted. It looks like MS Exchange adheres more to the RFC then other MTA’s.

The most simple solution is to always quote the display-name and change this line:

$this->add_header(‘From: ‘.$this->from_name.’ <’.$this->from_email.’>’);

to

$this->add_header(‘From: “’.$this->from_name.’” <’.$this->from_email.’>’);

Perhaps an extra check should be added to only do this when it’s required by the RFC.

In this particular case the from_name was set to an e-mail address by the tx_powermail extension. Perhaps the problem should be solved from that end but I think the community should decide on that.

(issue imported from #M16266)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.