Board index » delphi » DNSresolver and mx

DNSresolver and mx

I use indy DNSresolver to lookup the mx record for email addresses to find
the mail server they belong too.
Some email addresses will return an mx record but some others will not. I
tried different dns servers and I found out that non of them will resolve
all my email addresses. I am using the dns server that my ISP has and some
others I found but I need one that will correctly return the mx record for
all email addresses. Is there such a beast or am I doing something wrong.
Thanks
 

Re:DNSresolver and mx


"James" <sundiskATiname.com> wrote in <93vkd3$qs...@bornews.inprise.com>:

Quote
>I use indy DNSresolver to lookup the mx record for email addresses to find
>the mail server they belong too.
>Some email addresses will return an mx record but some others will not. I
>tried different dns servers and I found out that non of them will resolve
>all my email addresses. I am using the dns server that my ISP has and some
>others I found but I need one that will correctly return the mx record for
>all email addresses. Is there such a beast or am I doing something wrong.

An MX record is optional. If no MX record exists, you should assume that
the A record should be used. (There can be more than one A record for a
hostname, just as there can be more than one MX record.) In some cases, an
email address might even use a host alias instead of a host canonical name,
so you won't find either an MX or A record for the name, only a CNAME
record (which maps aliases to their canonical name). A CNAME record might
even point at another CNAME record, so you'll need to expand CNAME's until
you find an A or MX record.

Additionally, once you get an IP address, you should look up its PTR record
to make sure the address maps back to the name in the A record you found.

To know The Right Thing To Do, I suggest getting a copy of the source to
sendmail (http://www.sendmail.org) and looking at what it does with
hostnames in email addresses.

BTW, why do you need to do this? Are you writing an MTA like sendmail? If
you're just writing a MUA (mail user agent), then you shouldn't worry about
MX records, but should just hand the mail to an MTA and let it figure out
what to do.

Re:DNSresolver and mx


Quote
"Kenneth Porter" <kenneth_por...@kensingtonlabs.com> wrote in message

news:Xns902BE7F37kpkl@207.105.83.62...

Quote
> BTW, why do you need to do this? Are you writing an MTA like sendmail? If
> you're just writing a MUA (mail user agent), then you shouldn't worry
about
> MX records, but should just hand the mail to an MTA and let it figure out
> what to do.

I am doing this to send mail without using an smtp server.

Re:DNSresolver and mx


sundiskATiname.com (James) wrote in <944ee5$pa...@bornews.inprise.com>:

Quote
>I am doing this to send mail without using an smtp server.

Query the MX record, and then set the host of the SMTP to that record.

--
Chad Z. Hower (Kudzu) - Church Hill, TN - Team Indy
      "Programming is an art form that fights back"
Forget the Y2K problem, Lets fix the W2K problem.
http://www.pbe.com/Kudzu/ - Free Delphi/CBuilder components and articles

Re:DNSresolver and mx


chad...@pbe.com (Kudzu - Team Indy) wrote in
<902CEEAD8chadngpbe...@207.105.83.62>:

Quote
>Query the MX record, and then set the host of the SMTP to that record.

Note that the MX is optional, though. If no MX exists, use the A record. If
no A record, but there's a CNAME, follow the CNAME's until you find either
an MX or an A.

Other Threads