exim4_mail_route.pl



NAME

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


DESCRIPTION

Test <mail address> against Debian Exim4 routing tables.


COPYRIGHT

Copyright 2010 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.


#!/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+<--)/); 
    }
}