[dev] Error parsing this To: field (potentially invalid?)

Jan Schneider jan at horde.org
Thu Mar 12 18:49:15 UTC 2020


Zitat von Julian Espérat <savageman86 at gmail.com>:

> Hi there,
>
> I am parsing emails, and I have one particular example that gives me
> an empty "To" header where I believe it should (could?) work.
>
> Here's the minimal sample to reproduce:
>
> echo (string) (new \Horde_Mime_Headers_Addresses('To',
> '"A=?utf-8?Q?Name=22?= <email at gmail.com>')); // empty string (expected: "A
> name <email at gmail.com>")
>
> The recipient display name is enclosed in quotes: the first quote is
> not encoded, but the 2nd one is contained within an utf8-encoded
> portion (before anyone asks: in my minimal sample, it doesn't make
> sense to have this utf8-encoded portion, but it does in the email I'm
> parsing).
>
> The cause may well be a buggy email client that messed up the encoding
> and did it badly, but it would also probably be nice to handle this
> edge-case into the Horde libraries?
>
> Thanks for reading,
> -Julian

We use PHP's internal quoted_printable_decode() function for decoding  
this, so there isn't much Horde can do about this broken string.

-- 
Jan Schneider
The Horde Project
https://www.horde.org/



More information about the dev mailing list