You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mime4j-dev@james.apache.org by Philip Whitehouse <ph...@whiuk.com> on 2016/03/22 12:27:57 UTC
Quoted/escaped email address parsing
Hi Mime-4J Dev,
I'm using the AddressBuilder class in Mime-4J (v0.7.2) to parse email
addresses from MIME headers and it appears to deal oddly with quoted
email addresses. Right now this is mostly a theoretical concern as
nobody seems to deploy them:
If you call:
AddressBuilder.DEFAULT.parseAddressList("Anonymous
<ve...@example.com>").get(0).getString()
you get back:
very.common@example.com
But if you call:
AddressBuilder.DEFAULT.parseAddressList("Anonymous
<"v...@example.com>").get(0).getString()
you also get back:
very.common@example.com
But I was expecting:
"very.common"@example.com
For this example it might well be the same user but:
Anonymous <"v...@example.com>
will be returned as:
very.unusual.@.unusual.com@example.com
which is then invalid.
It only appears to remove one level of escaping & quoting, so instead
of:
"very.(),:;<>[]\".VERY.\"very@\\ \"very\".unusual"@strange.example.com
you get:
very.(),:;<>[]".VERY."very@\ "very".unusual@strange.example.com
Am I using the API wrong for this sort of parsing of MIME headers?