From: "Hendra ." on
Hi All,

I'm new to postfix as well as to this mailing list, so I apologize in
advance for any blunder ;)

Need some expert advice on what I'm trying to achieve but encountered
a major roadblock so far.
I need a mail server with a catch-all address but limit the recipient
pattern to xxxx-keyword(a)example.com, and forward it to an existing
local account.
The xxxx-keyword(a)example.com is an auto-generated address by another
application so these addresses will not be available as a lookup/map
table to postfix.
So far the postfix server I've setup can already accept the catch-all
address and forward it the local account as intended, however I want
to reject those that
do not match the xxxx-keyword pattern, even existing for existing
account that doesn't have the keyword in the name.
I've tried using the regexp in header_checks, but as soon as I added
the negation, it doesn't work as expected.
For example:

!/^To: (.*)-keyword@(.*)$/ REJECT => all mails get rejected

Any help?

H

From: Ansgar Wiechers on
On 2010-07-14 Hendra . wrote:
> I need a mail server with a catch-all address but limit the recipient
> pattern to xxxx-keyword(a)example.com, and forward it to an existing
> local account.
> The xxxx-keyword(a)example.com is an auto-generated address by another
> application so these addresses will not be available as a lookup/map
> table to postfix.

Why? If you can auto-generate them, you can auto-map them for Postfix.

> So far the postfix server I've setup can already accept the catch-all
> address and forward it the local account as intended, however I want
> to reject those that do not match the xxxx-keyword pattern, even
> existing for existing account that doesn't have the keyword in the
> name.
> I've tried using the regexp in header_checks, but as soon as I added
> the negation, it doesn't work as expected.
> For example:
>
> !/^To: (.*)-keyword@(.*)$/ REJECT => all mails get rejected

That's probably because there are a *lot* headers in any given mail that
don't match this pattern. ;)

Try something like this:

if /^To: .*@example\.com$/
!/^To: (.*)-keyword@(.*)$/ REJECT
endif

Regards
Ansgar Wiechers
--
"Abstractions save us time working, but they don't save us time learning."
--Joel Spolsky