finding the mail server of a domain

Gerhard Häring gerhard.haering at gmx.de
Tue Oct 1 15:55:51 EDT 2002


Gillou wrote in comp.lang.python:
> Hi pythonistas,
> 
> I'm looking for a pythonic way to find the hostname/IP of the mail server
> for a given domain. (that's not for spamming :) but to check the members
> database of a customer).
> 
> Any hint ?

Using http://pydns.sourceforge.net/

>>> import DNS
>>> DNS.ParseResolvConf()
>>> print DNS.mxlookup("nerim.net")
[(10, 'brinstar.nerim.net'), (20, 'metroid.nerim.net'), (30,
'aline.noc.nerim.net')]

If you want to use this to check for valid email adresses, forget it.
Any properly configured SMTP server won't return useful data (because
of spammers).

-- Gerhard



More information about the Python-list mailing list