bugfix.. the last version didn't handle local addresses properly:
#!/usr/local/bin/perl
$addr = $ARGV[0];
$ck = `sendmail -bv $addr`;
if ($ck =~ /mailer local/) {
print "$addr is a local address.\n";
exit;
}
($status, $domain) = $ck =~ /(\S+): .* host (\S+),/;
if ($status eq 'deliverable') {
$l = `nslookup -type=mx $domain`;
@mx = $l =~ /mail exchanger = (\S+)/g;
if (0 == @mx) {
print "the domain $domain has no mail exchanger.\n";
exit;
}
for $item (@mx) {
@A = gethostbyname($item);
print "name = $A[0]\n";
print "aliases = $A[1]\n";
print "type = $A[2]\n";
print "length = $A[3]\n";
print "address = ", join ('.', unpack ('C4', $A[4])), "\n\n";
}
} else {
print "$addr is undeliverable.\n";
}
which just goes to show that even when the code is small, you still have to
make sure all the bases are covered.
mike stone <[EMAIL PROTECTED]> 'net geek..
been there, done that, have network, will travel.
____________________________________________________________________
--------------------------------------------------------------------
Join The Web Consultants Association : Register on our web site Now
Web Consultants Web Site : http://just4u.com/webconsultants
If you lose the instructions All subscription/unsubscribing can be done
directly from our website for all our lists.
---------------------------------------------------------------------