Re: [exim] RFC 822 local-parts

Página Principal
Apagar esta mensagem
Responder a esta mensagem
Autor: Viktor Dukhovni
Data:  
Para: exim-users
Assunto: Re: [exim] RFC 822 local-parts
On Sat, Apr 05, 2014 at 03:50:40PM +0100, Andy Bennett wrote:

> andyjpb@???
> Andy Bennett <andyjpb@???>
> "Andy Bennett"@???
> "Andy\ Bennett"@???
>
> My trouble starts with the last two examples above. RFC 822 talks about
> local-parts being "uninterpreted" however, their parser specification in
> section-3 would decode the last two encodings to the same local-part.


Correct, uninterpreted by everything except the system receiving
email for the named mailbox.

> When reencoding it, am I allowed to generate either encoding?


Yes, but you should emit addresses without unnecessary quoted
strings or quoted pairs, sot the first one (without the backslash)
is preferred.

> In other parts of RFC 822 (http://tools.ietf.org/html/rfc822#section-6.2
> ) they talk about "uninterpreted" parts of the domain and I'm pretty
> sure that "canonicalisation" of the domain part is allowed.


RFC 822 was superceded by RFC 2822 and in turn 5322. Canonicalizing
the domain is no longer allowed except at the receiving system.

> So, do I just have to preserve case in local-parts or do I have to
> preserve the encoding in its entirety?


You can and should remove unnecessary backslashes in quoted strings
where the subsequent character is not a backslash or double-quote.

You can and should de-quote the localpart when the contents of the
quoted string are a valid dot-atom, per the grammar of RFC 5322:

"foo.\bar"@??? -> "foo.bar"@??? -> foo.bar@???

You should also quote invalid local parts that are not dot-atoms:

    foo..bar@??? -> "foo..bar"@???
    foo:bar@???    -> "foo:bar"@???
    ...


Of course one should also avoid creating mailboxes whose local-parts
require quoting, that is just asking for all sorts of pain.

-- 
    Viktor.