View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Max Maischein > Test-Exim4-Routing-0.02 > Test::Exim4::Routing



Annotate this POD

View/Report Bugs
Module Version: 0.02   Source  


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';


  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 '', 'dnslookup';

  routes_as 'corion', 'virtual_local_mailbox'; # because ~corion/.forward contains
  routes_as '', 'virtual_local_mailbox';

  # Check our local domains
  for my $domain (qw( )) {
    routes_as "postmaster\@$domain", 'virtual_local_mailbox';

  # Check that our exim4 blacklists work:
  discards_ok '';
  discards_ok '';

  undeliverable_ok '';


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.

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_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.

routes_ok $address, $name

Checks that exim4 knows how to route the email address $address.

routes_as $address, $rule, $name

Checks that exim4 routes $address using the exim4 rule named $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


Copyright 2008-2009 by Max Maischein


This module is released under the same terms as Perl itself.

syntax highlighting: