Improperly Quoted Addresses

From Messaging Server Technical Reference Wiki
Jump to: navigation, search

The syntax rules for e-mail addresses are fairly complex and some software either does't handle all the cases correctly or has bugs in handling some obscure cases.

One specific case that comes up from time to time is where a pair of superfluous single or double quotes ends up around an entire address, e.g.,


Both of these are fairly problematic, for different reasons.

The first of these is actually syntactically valid - single quotes are treated as ordinary characters in both the local and domain parts of addresses. But this means that the address has a local part of 'user and a domain part of host' and that is unlikely to be what was intended, if for no other reason than host' cannot be a valid domain name in the DNS.

The syntactic validity of the first address it actually something of a problem because no heuristics are ever applied to syntactically valid addresses. So the address is successfully parsed but is then likely to be rejected by the subsequent rewriting process. And even if it isn't rejected the quotes will still be present and will inevitably cause the address to be rejected at some point.

One possible workaround is to use the address rewriting facilities to remove the superfluous single quotes. This can be done with a rewrite rule

$*          $E$F${QUOTE_CHECK,$U$@$H}

that calls a mapping:


  '*@*'            $Y$0%$1

The surrounding double quotes make the second address a valid local part. However, a local part by itself is not a valid address - a domain must also be present. And while the MTA applies various fixups to try and make syntactic invalid addresses valid, in this particular case the heuristics get confused by the presence of the @ and don't try adding a default domain. The heuristics have been altered in the 7.0-0 version of Messaging Server to try adding a default domain.