From owner-freebsd-questions Mon Jun 1 14:58:30 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA18579 for freebsd-questions-outgoing; Mon, 1 Jun 1998 14:58:30 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from dt050n33.san.rr.com (@dt053nd2.san.rr.com [204.210.34.210]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA18400 for ; Mon, 1 Jun 1998 14:57:56 -0700 (PDT) (envelope-from Studded@san.rr.com) Received: from san.rr.com (Studded@localhost [127.0.0.1]) by dt050n33.san.rr.com (8.8.8/8.8.8) with ESMTP id OAA23214; Mon, 1 Jun 1998 14:57:40 -0700 (PDT) (envelope-from Studded@san.rr.com) Message-ID: <357323D4.FE221A2E@san.rr.com> Date: Mon, 01 Jun 1998 14:57:40 -0700 From: Studded Organization: Triborough Bridge & Tunnel Authority X-Mailer: Mozilla 4.05 [en] (X11; I; FreeBSD 2.2.6-STABLE-0507 i386) MIME-Version: 1.0 To: Leif Neland CC: leifn@internet.dk, questions@FreeBSD.ORG Subject: Re: perl, MX lookup References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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