5

This comment led me to RFC 5322 § 3.4.1 which reads:

An addr-spec is a specific Internet identifier that contains a locally
interpreted string followed by the at-sign character ("@", ASCII value
64) followed by an Internet domain. 

The locally interpreted string is either a quoted-string or a dot-atom.

If the string can be represented as a dot-atom (that is, it contains no
characters other than atext characters or "." surrounded by atext  
characters), then the dot-atom form SHOULD be used and the quoted-  
string form SHOULD NOT be used.  Comments and folding white space   
SHOULD NOT be used around the "@" in the addr-spec.

And we can see what atext is here.

atext           =       ALPHA / DIGIT / ; Any character except controls,
                        "!" / "#" /     ;  SP, and specials.
                        "$" / "%" /     ;  Used for atoms
                        "&" / "'" /
                        "*" / "+" /
                        "-" / "/" /
                        "=" / "?" /
                        "^" / "_" /
                        "`" / "{" /
                        "|" / "}" /
                        "~"

Putting this all together, does that mean that the email address email@"happy@guy.com" is actually a valid address, since the quotes allow the usage of the @ symbol?

2 Answers 2

11

No it's not valid.

The part after the @ is the domain ("happy@guy.com" in your example).

You can't have a domain name with @ symbol in.

What are the valid characters for a domain name and how long can it be?

Also check out RFC 1035 2.3.1:

They must start with a letter, end with a letter or digit, and have as interior characters only letters, digits, and hyphen.

More info:

8
  • Interesting. Letters, digits, and hyphens are all atext. So I wonder what kind of domain would require quotes as specified in 3.4.1?
    – Cory Klein
    Sep 26, 2013 at 19:44
  • Ah, I think I have been reading it incorrectly. When mentioning the quotes it is talking about the text before the @ sign and domain. So maybe "email@email"@happyguy.com is a valid email address?
    – Cory Klein
    Sep 26, 2013 at 19:45
  • 1
    From RFC 5322 regarding the domain name: "Note: A liberal syntax for the domain portion of addr-spec is given here. However, the domain portion contains addressing information specified by and used in other protocols (e.g., [RFC1034], [RFC1035], [RFC1123], [RFC5321]). It is therefore incumbent upon implementations to conform to the syntax of addresses for the context in which they are used." Sep 26, 2013 at 19:52
  • 1
    in general Wikipedia's descriptions are a little less cryptic than the RFC's. Check out en.wikipedia.org/wiki/E-mail_address#Local_part Sep 26, 2013 at 20:00
  • 2
    Sometimes you can work around this because the email address input mis-validator is on the actual webpage and then you can use things like firebug or webscarab to edit the script which incorrectly validates stuff. It is annoying though.
    – Hennes
    Sep 27, 2013 at 13:14
2

The rules for emails are so mind-bogglingly complex (and seldom followed completely correctly) that asking whether an email is valid isn't particularly helpful. Rather, it's a question of how many websites will accept your email. The more exotic an e-mail address is, the more likely it is you'll run into websites that don't accept it - even if it's in the RFC standard. For example, my.email@com is technically a valid e-mail, but you'll have a tough-as-nails time using it.

If you're an end-user, this means that you should generally pick e-mails that don't get too creative, whether or not you can. Coming up with an email that pushes the rules can make it difficult to use some websites, even if it's technically valid.

If you're maintaining software and need to validate a user's email, your best bet is to send him or her a validation email. This way, you'll be able to check whether the user's email address actually exists without having to worry about accidentally blocking users whose emails fail to conform to the RFC standards or whose emails follow edge-condition rules. (It is worth using some common-sense rules for client-side validation to help users fix typos, but you should let users override that validation if they need to.)

This question from StackOverflow discusses the issues pretty well. For what it's worth, this website lets you check whether emails are actually valid. The second comment on the page gives an example of someone with a valid e-mail address that is hard to use because of how unusual it is.


To answer your original question: No, email@"happy@guy.com" is not a valid e-mail address. Even if it were, though, I would caution against using it, and if a user claims that's his email, you should send him a validation email anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.