Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 215
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 216
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 217
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 218
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 219
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 220
#!/usr/local/bin/perl -w
# $Id: mx 264 2005-04-06 09:16:15Z olaf $
=head1 NAME
mx - Print a domain's MX records
=head1 SYNOPSIS
C I
=head1 DESCRIPTION
C prints a domain's MX records, sorted by preference.
=head1 AUTHOR
Michael Fuhr
=head1 SEE ALSO
L, L, L, L, L, L,
L
=cut
use strict;
use File::Basename;
use Net::DNS;
die "Usage: ", basename($0), " domain\n" unless (@ARGV == 1);
my $dname = $ARGV[0];
my $res = Net::DNS::Resolver->new;
my @mx = mx($res, $dname);
if (@mx) {
foreach my $rr (@mx) {
print $rr->preference, "\t", $rr->exchange, "\n";
}
} else {
print "Can't find MX hosts for $dname: ", $res->errorstring, "\n";
}