Matt - This worked for me from my linux box at work,
but not on my home network using win2k...I guess you
just need to hit the right server. BTW, I just yanked
this from the documentation.

#!/usr/bin/perl -w
use Net::DNS;
$name = 'perl.org';
$res = new Net::DNS::Resolver;
@mx = mx($res, $name);
if (@mx) {
      foreach $rr (@mx) {
          print $rr->preference, " ", $rr->exchange,
"\n";
      }
  }
  else {
      print "can't find MX records for $name: ",
$res->errorstring, "\n";
  }


Run from the command line gave me:

[mcauthorn@bubba mcauthorn]$ perl mx_test.pl
12801 perlmail.valueclick.com
12816 mimer.null.dk

** Remember that the @mx array is an array of objects
that get returned from the query. Hence the " $res-> "
calls in the foreach loop.

Hope this helps!

~Matt C.


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Reply via email to