Validating EMailAdresses for syntactical correctness
Cameron Laird
claird at starbase.neosoft.com
Thu Jan 24 18:24:43 EST 2002
In article <mailman.1011896959.22291.python-list at python.org>,
Mark McEahern <marklists at mceahern.com> wrote:
>Michael W. Dietrich wrote:
>> 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?
>
>Hmm, have you tried google? There may not be such in Python, but I'm sure
>you can translate whatever samples you find. The basic idea is to use
>regular expressions, right? I remember seeing an approach that explicitly
>provided different levels of strictness. Something like this:
>
>Level 1: Just make sure you have something at something
>
>Level 2: Make sure you have something at something.something
>
>Level 3: Make sure the tld is valid.
>
>Level 4: Make sure the domain is valid (whois, ping, etc)
>
>Level 5: Make sure the address itself is valid (resolve the mx record and
>test the address via smtp).
> .
> .
> .
... and even then, there are no guarantees. You can go all
the way through Level 5, and *still* find a bogus address
on your hands. Make sure your customer/client/supervisor
understands that.
E-mail connectivity is only weakly about syntax, despite the
eagerness of many practitioners to show off their REs.
--
Cameron Laird <Cameron at Lairds.com>
Business: http://www.Phaseit.net
Personal: http://starbase.neosoft.com/~claird/home.html
More information about the Python-list
mailing list