[TYPO3-core] RFC #13435: t3lib_htmlmail -> from_name in FROM header not quoted

Ernesto Baschny [cron IT] ernst at cron-it.de
Fri Mar 5 10:53:11 CET 2010


Stefan Galinski schrieb am 27.02.2010 18:10:

>> yes, let's do it through complete htmlmail.
>>
>> I would rename the function to quoteNameForMail (may be you have a
>> better name) so it's understandable without reading function description.
>>
>> Do you want to make the *final* version ?

> The eight version adds the double quote characters always around the string 
> and removes any other occurences of this characters. Also the documentation 
> and method name has changed.

Sorry to intervene.

To clarify some mail-related terminology. Here:

	From: Dummy Name <dummy at example.com>

we have the "display name" (Dummy Name) and the email. The display name
needs to be a "phrase" as per RFC 2047, to be recognizeable as a single
token. Which is why we have the quoting problem after all.

Since it cannot be that we are the first to stumble over this problem in
PHP, I took a look what others did.

After looking at phpmailer (which does it correctly also), I had a look
at Swift mailer PHP library [1], which provides a very neat API to
creating and sending e-mails. Here is the part which handles
address-headers:

	http://swiftmailer.org/docs/header-mailbox

The method we are trying to implement here is what in Swift is:

	Swift_Mime_Headers_AbstractHeader::createPhrase() [2]

This proves to be much more than what we are doing right now. It needs
to consider the charset, if there are non-ascii bytes being used (in
which case it needs to be encoded separately) and then consider all
valid chars for a "phrase" as per RFC before quoting with a '"'.

So either we implement it correctly (as Benni said, so that we don't
need to fix it again and again), or the "bigger alternative" would be to
move over to Swift as a contrib library to handle our mailing tasks (and
use t3lib_htmlmail only as a "wrapper" to Swift. The benefit of doing
that would be that we can be more RFC compliant much faster and also
without the need for us TYPO3-developers to dig into the very unpleasant
to read mail-related RFCs.

What do you think?

Cheers,
Ernesto


[1] http://swiftmailer.org/
[2]
http://github.com/swiftmailer/swiftmailer/blob/master/lib/classes/Swift/Mime/Headers/AbstractHeader.php


More information about the TYPO3-team-core mailing list