I need to set up a mail server config for a test environment which would accept all mail (i.e. for all users and all domains, even non-local ones) and put it into a single local catchall mailbox.

What I have is SLES 11 with Sendmail (8.14) where I tried modifying /etc/mail/virtusertable to look like

@ catchall

or like

@* catchall

but to no avail - destination mail addresses (e.g. "santa@northpole.org") are not rewritten to catchall@, so delivery is tried to the appropriate MX:

# sendmail -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> 3,0 santa@northpole.org
canonify           input: santa @ northpole . org
Canonify2          input: santa < @ northpole . org >
Canonify2        returns: santa < @ northpole . org . >
canonify         returns: santa < @ northpole . org . >
parse              input: santa < @ northpole . org . >
Parse0             input: santa < @ northpole . org . >
Parse0           returns: santa < @ northpole . org . >
ParseLocal         input: santa < @ northpole . org . >
ParseLocal       returns: santa < @ northpole . org . >
Parse1             input: santa < @ northpole . org . >
MailerToTriple     input: < > santa < @ northpole . org . >
MailerToTriple   returns: santa < @ northpole . org . >
Parse1           returns: $# esmtp $@ northpole . org . $: santa < @ northpole . org . >
parse            returns: $# esmtp $@ northpole . org . $: santa < @ northpole . org . >

It seems like wildcards are not supported in the source domain part of the lookup table.

How would I implement this with Sendmail?

Edit: As per Andrzej's comments I have tried a mailertable entry of

. local:catch-all-outgoing

as well as

.. local:catch-all-outgoing

and received identical output for sendmail -bv in both cases:

# sendmail -d60.5 -bv jd@example.net
map_lookup(dequote, root, %0=root) => NOT FOUND (0)
map_lookup(host, example.net, %0=example.net) => example.net. (0)
jd@example.net... deliverable: mailer esmtp, host example.net., user jd@example.net

(yes, root, as sendmail seems unable to run as non-root)

Edit: it turned out, the mailertable feature has not been enabled in the macro file, thus sendmail.cf did not contain the appropriate rewrite rules for it to work.

2 Answers 2


What you are running into here: /etc/mail/virtusertable I believe is limited to inbound email only, not outbound.

You can use default route in mailertable or SMART_HOST to deliver all non local messages to one local mailbox/alias.

mailertable entry:
. local:catch-all-outgoing

catch-all-outgoing: some-local-account

Any LHS entry that does not begin with a dot matches the full host name indicated. LHS entries beginning with a dot match anything ending with that domain name (including the leading dot) -- that is, they can be thought of as having a leading ".+" regular expression pattern for a non-empty sequence of characters.

The RHS should always be a "mailer:host" pair. The mailer is the configuration name of a mailer (that is, an M line in the sendmail.cf file). The "host" will be the hostname passed to that mailer.

(reference: sendmail readme, "USING MAILERTABLES" section)

So something like:

. local:catch-all-outgoing (just a single dot as per Adrzej's comment) in /etc/mail/mailertable should cause any domain.tld to redirect to the local mailer config defined in sendmail.cf. With the alias catching the hostname of catch-all-outgoing and causing it to be a local email address.

For the mailertable to work, it needs to be enabled in the config. Adding

FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl

to the m4 macro file generating your config should take care of that.

Also from the sendmail site help files:


Include a "mailer table" which can be used to override routing for particular domains (which are not in class {w}, i.e. local host names). The argument of the FEATURE may be the key definition. If none is specified, the definition used is:

hash /etc/mail/mailertable

Keys in this database are fully qualified domain names or partial domains preceded by a dot -- for example, "vangogh.CS.Berkeley.EDU" or ".CS.Berkeley.EDU". As a special case of the latter, "." matches any domain not covered by other keys. Values must be of the form: mailer:domain

where "mailer" is the internal mailer name, and "domain" is where to send the message. These maps are not reflected into the message header. As a special case, the forms: local:user will forward to the indicated user using the local mailer,

  • I've tried the mailertable route, but it appears not to do that for me - mails are still in delivery to their original destination domains. And yes, I've run newaliases and makemap for the mailertable.
    – the-wabbit
    Sep 11, 2013 at 15:30
  • sendmail.com/sm/open_source/docs/m4/mailertables.html and edc.tversu.ru/elib/inf/0047/… might help. I've updated my post with some of the info from there. Hopefully it helps...I can spin up a VM to test with later today possibly.
    – TheCleaner
    Sep 11, 2013 at 15:44
  • Default route in mailertable is specified by single dot key (.), not by double dot key key (..).
    – AnFi
    Sep 11, 2013 at 16:06
  • 1
    @syneticon-dj use sendmail -d60.5 -bv jd@example.net to trace map (includes mailertable) lookups/lack of mailertable lookups.
    – AnFi
    Sep 11, 2013 at 16:12
  • @AndrzejA.Filip thanks a heap, it worked out a bit. Using sendmail -bv helped me see that the mailertable has not been used at all in this configuration. The appropriate FEATURE directive has been missing in the m4 macro file and thus was not part of the config. Also, you are right about the single dot.
    – the-wabbit
    Sep 11, 2013 at 20:12

Sendmail: catchall for local and non local adressess

You may define SMART_HOST for non local domains and MAIl_HUB for local email domains.


dnl optional part to list local users/mailboxes excluded from the redirect
dnl in /etc/mail/direct-users file (one user per line)


Use echo '$=w' | sendmail -bt to get list of local email domains. Sendmail by default fills it auto-magically.

mailertable may be used to exclude some external domain from the redirect

example.net %0
  • Now this is even easier than the mailertable. Every time I see Sendmail, it amazes me but also scares me with its .cf.
    – the-wabbit
    Sep 12, 2013 at 17:41
  • There is more complicated configuration that allows to record envelope recipients adressess in headers of delivered mail. I think it may be very handy in some test environments.
    – AnFi
    Sep 12, 2013 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.