Validating EMailAdresses for syntactical correctness

Alexander Skwar ASkwar at
Sat Jan 26 20:04:51 EST 2002

So sprach »Michael W. Dietrich« am 2002-01-24 um 10:19:12 -0800 :
> 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?

Forget it.  Although there are some "rules" defined by the RFCs about
how the localpart (before the @) should look like, in reality you'll
find that close to every character can appear there.  I'm just starting
with Python, but in PHP based apps, I resorted to simply checking if
there's a MX (mail exchange) server listed for the domain.  If that
returns true, then all is fine.

Alexander Skwar
How to quote: (german) (english)
Homepage:      |     Jabber: askwar at - Die günstige Art an Linux Distributionen zu kommen
                       Uptime: 12 days 3 hours 28 minutes

More information about the Python-list mailing list