Bug #23955
closedfrom_name should be quoted (at least when it's an e-mail address)
0%
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@domain.com>
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>
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)