[Tutor] How to check whether email /domain exists

dman dman@dman.ddts.net
Thu, 4 Apr 2002 08:29:23 -0600


On Wed, Apr 03, 2002 at 10:33:31AM +0200, A wrote:
| Hello,
| What is the simplest way how to check 
|  whether a given email address( or domain for this email) exists?
| Thanks for help

$ host -t mx <domain>
$ host -t a <domain>

You need to do a DNS lookup.  Sites SHOULD have a MX records that look
like :
    $ host -t mx dman.ddts.net
    dman.ddts.net       	MX	1 dman.ddts.net
    dman.ddts.net       	MX	10 dman2.ddts.net
The name on the left is the domain, the name on the right MUST point
to an A (or AAAA or A6 for IPv6) record, not a CNAME.  For example :
    $ host -t a dman.ddts.net
    dman.ddts.net       	A	65.107.69.216

I don't know what python modules/functions there are for performing
DNS queries.

You can _try_ to test for the existence of an email address by opening
an SMTP session with an MX for the domain and trying the "EXPN" or
"VRFY" commands, but many sites disable those because spammers can use
that to harvest valid addresses.

HTH,
-D

-- 

A)bort, R)etry, D)o it right this time