Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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. "") 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
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
map_lookup(dequote, root, %0=root) => NOT FOUND (0)
map_lookup(host,, => (0) deliverable: mailer esmtp, host, user

(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 did not contain the appropriate rewrite rules for it to work.

share|improve this question
up vote 2 down vote accepted

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 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 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,

share|improve this answer
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 '13 at 15:30 and… 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 '13 at 15:44
Default route in mailertable is specified by single dot key (.), not by double dot key key (..). – Andrzej A. Filip Sep 11 '13 at 16:06
@syneticon-dj use sendmail -d60.5 -bv to trace map (includes mailertable) lookups/lack of mailertable lookups. – Andrzej A. Filip Sep 11 '13 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 '13 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 %0
share|improve this answer
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 '13 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. – Andrzej A. Filip Sep 12 '13 at 20:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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