Date: Mon, 01 Jun 1998 14:57:40 -0700 From: Studded <Studded@san.rr.com> To: Leif Neland <root@internet.dk> Cc: leifn@internet.dk, questions@FreeBSD.ORG Subject: Re: perl, MX lookup Message-ID: <357323D4.FE221A2E@san.rr.com> References: <Pine.BSF.3.96.980601231752.283A-100000@darla.swimsuit.internet.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
Leif Neland wrote: > > On Sun, 31 May 1998, Studded wrote: > > > Leif Neland wrote: > > > > > > In a perlscript, I can use gethostbyname to check if a given host exists. > > > > > > But how can I check if there exists a MX-record for a given host? > > > I probably could system("host -t MX $host"), but I'd rather have a > > > "native" perl solution. > > > > > > (I want to check in a script if an email-adress contains a valid hostpart) > > > > Keep in mind that the abscence of an MX record doesn't make a hostname > > an invalid delivery address. The default (which is quite servicable in > > most cases) is to attempt delivery to the A address. > > Yep. But my attempt with gethostbyname required the host-part of the > email-adress to have an IP-adress. It worked with the adresses I tested, > but then my boss tested with his own domain, which only had an MX, so my > test failed. Bummer... *Nod* That's a slightly different problem. The Net::DNS perl module has what you need though, there is a port in /usr/ports/net/p5-Net-DNS. I'm sure you're aware of course that you want to do the hostname lookup on the host returned as an MX record too since an MX without an A might be a way to avoid spam-detection. Good luck, Doug PS, you might want to publish that script here when it's done, it might help save someone else going through what you had to. :) -- *** Chief Operations Officer, DALnet IRC network *** *** Proud designer and maintainer of one of the world's largest *** Internet Relay Chat servers with 5,328 simultaneous connections *** Try spider.dal.net on ports 6662-4 (Powered by FreeBSD) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?357323D4.FE221A2E>