#!/usr/bin/perl -w

use strict;

@ARGV > 0 or die << "USAGE";

usage: $0 <mail address> [<mail address> [ <mail ... ]]

test <mail address> against MTA routing tables.
USAGE

my $c = "/usr/sbin/exim4 -bt %s 2>/dev/null";

for my $m (@ARGV) {
    my $x = sprintf $c, $m;
    printf "mail for:\n\t%s\ngoes to:\n", $m;
    for (qx!$x!) { 
        chomp;
        printf "\t%s\n", $_ if (/^(\S|\s+<--)/); 
    }
}

=head1 NAME

B<mail_route.pl> <mail address> [<mail address> [ <mail ... ]]

=head1 DESCRIPTION

Test <mail address> against Debian Exim4 routing tables.

=head1 COPYRIGHT

Copyright 2000-2007 Etienne LEMEE <coding AT etilem DOT net>

This piece of code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

=cut
