How do I deliver mail for wildcard addresses to a particular user/alias/program?

Posted by David M on Server Fault See other posts from Server Fault or by David M
Published on 2010-04-27T19:11:28Z Indexed on 2010/04/27 19:13 UTC
Read the original article Hit count: 320

Filed under:

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 blah.foo.com ESMTP server ready; Thu, 22 Apr 2010 20:41:08 -0700 (PDT)
HELO blort.foo.com
250 blah.foo.com Hello blort.foo.com [10.1.2.3], pleased to meet you
MAIL FROM: <[email protected]>
250 2.1.0 <[email protected]>... Sender ok
RCPT TO: <[email protected]>
250 2.1.5 <[email protected]>... Recipient ok

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

© Server Fault or respective owner

Related posts about sendmail