email addressing sucks

rjbs on 2007-04-23T15:38:55

I know that most people know how much email addresses suck, but I found this message in Mutt while looking for something else, and I thought it was a nice illustration.

A user of Email::Valid writes:

I was doing some testing with Email::Valid, and I came across this:

 $ perl -MEmail::Valid -e "print Email::Valid->address('dave@#%^&*$.com') ? 'yes' : 'no'"` yes $ 

This prints "yes", and I don't understand why that address would be seen as valid. It doesn't seem to matter what characters are in the domain part of the address, it always gets marked as valid.

I replied:

Let's have a look!

 dave@#%^&*$.com 

You don't think this should be valid. Let's consult the RFC.

Section 6.1 says that an address must be . That is:

 local-part "@" domain 

I'm guessing you don't dispute that "dave" is a valid local-part. A must be:

 sub-domain *("." sub-domain) 

I'm also guessing you don't dispite that "com" is a valid sub- domain. So, is "#%^&*$"? Well, let's see...

 sub-domain = domain-ref / domain-literal domain-literal = "[" *(dtext / quoted-pair) "]" domain-ref = atom 

There are no square brackets, so there is no domain-literal involved. That means that if "#%^&*$" is a valid atom, it is also a valid domain-ref, and the address matches the addr-spec pattern.

The atom pattern is:

 atom = 1* 

None of those characters are space or control characters. The specials are:

 specials = "(" / ")" / "<" / ">" / "@" ; Must be in quoted- / "," / ";" / ":" / "\" / <"> ; string, to use / "." / "[" / "]" 

None of them are specials, either! Are you shocked? Don't be! RFC822 sucks!

I hope this helped. Good night! :)


Strange domain names

bart on 2007-04-23T22:56:15

I wonder, could anyone ever actually register such a weird domain name? Because if not, that would be the difference between theoretically, and practically acceptable.

Re:Strange domain names

rjbs on 2007-04-24T03:07:07

Right. In fact, since this email exchange took place, Email::Valid's check that a domain is valid has become more useful, and would reject this. The only default test is for a fqdn, which has lately come to mean a fqdn for a valid internet domain.

Still, the awful thing is that the address is valid according to 822, just not deliverable on this Earth's internet.