Test::Exim4::Routing - test how exim4 routes mails
use strict; use Test::More; use Test::Exim4::Routing; plan tests => 18; # Set a custom mailer program #$Test::Exim4::Routing::mailer = '/opt/usr/sbin/exim4'; config_ok; routes_ok 'postmaster2@test.internal'; # Check that the router names resolve as we want them: routes_as 'postmaster2@test.internal', 'virtual_local_mailbox'; routes_as 'outbound@example.com', 'dnslookup'; routes_as 'corion', 'virtual_local_mailbox'; # because ~corion/.forward contains corion@corion.net routes_as 'corion@corion.net', 'virtual_local_mailbox'; # Check our local domains for my $domain (qw( corion.net datenzoo.de )) { routes_as "postmaster\@$domain", 'virtual_local_mailbox'; }; # Check that our exim4 blacklists work: discards_ok 'vacation@corion.net'; discards_ok 'michael.traven@corion.net'; undeliverable_ok 'does-not-exist@corion.net';
This module uses exim4 to verify how exim4 will route mails. This is less a module to test your program and more a module to test your system configuration, especially after changes to the mail configuration.
exim4
No mails are sent by this module, as exim4 can tell us the routing of mails without actually sending a mail. This means that we don't need to clean up after testing the routing, but it also means that other problems, like not enough diskspace or mail directories that don't exist will not be detected by this test.
You will need a working copy of exim4 on the machine running these tests.
So far, the module only checks against the default config file and does not allow specifying a different configuration file except in the config_ok check.
config_ok
config_ok $config_file
Checks that exim4 considers the configuration file as syntactically valid. If $config_file is not given, the default config file of exim4 is used.
$config_file
routes_ok $address, $name
Checks that exim4 knows how to route the email address $address.
$address
routes_as $address, $rule, $name
Checks that exim4 routes $address using the exim4 rule named $rule.
$rule
discards_ok $address, $name
Checks that exim4 discards mails with $address as a recipient.
undeliverable_ok $address, $name
Checks that exim4 rejects mails with $address as a recipient as undeliverable.
Max Maischein corion@cpan.org
corion@cpan.org
Copyright 2008-2009 by Max Maischein corion@cpan.org.
This module is released under the same terms as Perl itself.
To install Test::Exim4::Routing, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Exim4::Routing
CPAN shell
perl -MCPAN -e shell install Test::Exim4::Routing
For more information on module installation, please visit the detailed CPAN module installation guide.