what i need to do now is write some code
to find the mail exchanger for a given domain
for example if i send mail to iwa...@btclick.com
it gets sent to pop3.btclick.com
how can i get a list of all exchangers for domains?
cheers
You need to submit a query to a DNS server and decode the reply.
I have code that does this if you'd like a copy (it uses the dnslib code,
which I can also provide).
regards
Steve
--
-----------------------------------------------------------------------
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/pwp/
-----------------------------------------------------------------------
Look at the code in pydns.sf.net - there's a function in the lazy module
called "mxlookup". For instance,
>>> import DNS
>>> DNS.DiscoverNameServers() # win or unix, initialise resolver.
>>> DNS.mxlookup('interlink.com.au')
[(0, 'mx1.interlink.com.au'), (50, 'mx2.interlink.com.au')]
> I have code that does this if you'd like a copy (it uses the dnslib code,
> which I can also provide).
How does your dnslib differ from Guido's original code?
Anthony
--
Anthony Baxter <ant...@interlink.com.au>
It's never too late to have a happy childhood.
> > I have code that does this if you'd like a copy (it uses the dnslib
code,
> > which I can also provide).
>
> How does your dnslib differ from Guido's original code?
At this distance in time it's hard to say. Probably not at all, but there
was a time when dnslib wasn't always distributed.
Anyhway, since we seem to be in an ongoing problem solved situation, thanks
for the information.
No, it gets sent to one of
btclick.com MX 10 smtp.btclick.com
btclick.com MX 5 mail.btclick.com
(this is the output of "host -t MX btclick.com" on Linux. The "dig"
command would give something similar).
>how can i get a list of all exchangers for domains?
Do an MX lookup using PyDNS: http://pydns.sourceforge.net/
Note that not all domains will have an MX record, so you'd need to check
for A records if you don't find a mail exchanger.
The right thing for a client program to do is send the mail on to a
'smarthost' which will do the lookups for you and handle queuing and
retries and suchlike. But I'm assuming that, as your assignment is to
write a server, this isn't an option for you.
--
Paul Wright | http://pobox.com/~pw201 |
"Paul Wright" <-$P-W$-@verence.demon.co.uk> wrote in message
news:abqnrn$3c9$1...@verence.demon.co.uk...