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

Posted by David M on Stack Overflow See other posts from Stack Overflow or by David M
Published on 2010-04-23T03:47:00Z Indexed on 2010/04/23 3:53 UTC
Read the original article Hit count: 227

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.

© Stack Overflow or respective owner

Related posts about sendmail