Validating EMailAdresses for syntactical correctness

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


"Michael W. Dietrich" <Michael.W.Dietrich at modulo3.de> wrote in message news:54da4e24.0201241019.4a4b222e at posting.google.com...
> 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 http://rfc.net/rfc2822.html). 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:
http://www.serialscripter.com/scripts/EMailValidatorCLS.html
(JScript)

Branimir





More information about the Python-list mailing list