Validating EMailAdresses for syntactical correctness

Branimir Petrovic TheOne at
Sat Jan 26 12:41:39 EST 2002

"Michael W. Dietrich" <Michael.W.Dietrich at> wrote in message news:54da4e24.0201241019.4a4b222e at
> Has anyone ever written a class, function or regular expression, that
> validates EMail-Addresses (e.g. such entered in Web Forms) for their
> syntactical correctness? If so, is that algorithm available? Where?

Email validation is a tricky business. "Algorithm" is called RFC 2822
(see Be warned to set aside enough time
to go to the bottom. Once there (@theBottom) you'll probably realize
that proper testing/checking is just not worthwhile. Even though all
looks and feels right, the very first part (before @ char) may contain
unintentional (spelling) error and as a result - mail will never reach
the recipient...

One of many possible ways to tackle the problem:


More information about the Python-list mailing list