What is the RFC 822 format for the email addresses?

Adrian picture Adrian · Aug 31, 2013 · Viewed 21.3k times · Source

I have to make a regular expression for the email addresses (RFC 822) and I want to know which characters are allowed in the local part and in the domain.

I found this http://tools.ietf.org/html/rfc822#section-6.1 but I don't see that it says which are the valid characters.

Answer

Jukka K. Korpela picture Jukka K. Korpela · Aug 31, 2013

According to RFC 822, the local part may contain any ASCII character, since local-part is defined using word, which is defined as atom / quoted-string; atom covers most ASCII characters, and the rest can be written in a quoted-string. There are syntactic restrictions, but obeying them, any ASCII character can be used.

On similar grounds, RFC 822 allows any ASCII character in the domain part.

On the other hand, RFC 822 was obsoleted in 2001 by RFC 2822, which in turn was obsoleted in 2008 by RFC 5322. The status of RFCs can be checked from the RFC Editor’s RFC database.