#!/usr/bin/perl -w
use strict;
use Net::DNS::Resolver;
my $rawdestination = `postconf -h mydestination`;
chomp $rawdestination;
$rawdestination =~ s/localhost |localhost\.localdomain//g;
my @destination = split (" ",$rawdestination);
my @mxrec;
my $res = new Net::DNS::Resolver;
foreach my $domain (@destination)
{
@mxrec = Net::DNS::mx($res,$domain);
if (@mxrec)
{
print "MX for $domain is incorrect\n"
if $mxrec[0]->exchange ne "the.correct.mx";
}
else
{
print "Can't find MX records for $domain: ",
$res->errorstring, "\n";
}
}
|