socket

Peter Hansen peter at engcorp.com
Fri Mar 15 21:57:57 EST 2002


Billy Ng wrote:
> "Grant Edwards" <grante at visi.com> wrote:
> > Billy Ng wrote:
> > > I am trying to write a python program to verify the email
> > > address.
> >
> > What you're trying to do is pointless.  Whether it's evil or
> > not, I don't know, but one is suspicious.
> 
> Nothing evil here.  I have 2 reasons why I would do this program.  Firs, it
> is my TCP/IP concept class's project.  Basically, I want to try what the
> book tells in to code, but I notice it does not work the way it says in so
> many commercial SMTP servers.  Second, I have been unemployed for about 4
> months.  My friend's company needs a program to verify the users who
> registered to their service.  They found out many registered users were
> using fake addresses. 

I didn't think it was anything evil... I just wanted to know the background
because the answer is really always "it depends".  In this case, and as
you may learn from other answers (this has been discussed several times in
the last year, as well, if you care to search the newsgroup a little),
the *only* valid and effective way of confirming an email address is to
actually send an email to the address and request a reply.

I repeat, *all* other methods have various problems and do not, in general,
work.  They may work some of the time, but since they cannot be relied
upon there is no point wasting time trying to use them.  Send the email,
and if you get a reply then it's a valid address.  Alternatively, send
the email and if you don't get a bounce, assume it's valid.  Won't
make much difference in this case, it seems.

This is a parallel to doing exception handling in Python and similar
languages.  Don't check the parameters ahead of time, just try using
them but be sure to catch the exceptions in case they don't work.

-Peter



More information about the Python-list mailing list