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 configure sendmail so that mail delivered for wildcard addresses is accepted for delivery and then delivered to a user, alias, or directly to a script.

I can rewrite the envelope/headers any number of ways, but I don't know how to accept the wildcard address when it's provided in RCPT TO: Everything I've tried so far winds up with a 550 user unknown error.

So here's a specific example:

I want to be able to handle any address that consists of a series of digits followed by a dot followed by a word, then pipe that to a script. If the headers get rewritten, that's OK, but I need the envelope to contain the actual Delivered-To address.

Here's the sort of SMTP session I need:

220 ESMTP server ready; Thu, 22 Apr 2010 20:41:08 -0700 (PDT)
250 Hello [], pleased to meet you
250 2.1.0 <>... Sender ok
250 2.1.5 <>... Recipient ok

I tried some stuff with regex maps, but I never got past 550 user unknown.

share|improve this question
up vote 0 down vote accepted

You should add a line in your /etc/mail/virtusertable like this: account_catch_all

Then makemap the virtual user table, and all mail to that particular domain will be forwarded to the specified user. Then you can implement procmail to filter this according to whatever you need, or write your own scripts to parse the files...

share|improve this answer

I've done stuff like this by using the virtusertable. Not sure if this is exactly what you need but for example if you want to accept traffic for an entire domain and redirect it to a single address at another domain you'd put something like this in the virtusertable file:

Accept traffic for any address at somedomain and redirect it to the same address at someother domain:

To do the rest of the pattern matching you mentioned you'd need to either use a regex map or (my preference) handle it with something like procmail after the fact.

virtual domains are described in section 4.8.51 of the O'Reilly 'sendmail' book ("the bat book").

I hope this is helpful.

share|improve this answer

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.