Re: Negation in header_checks doesn't work as expected?

2010-07-14 Thread Ansgar Wiechers
On 2010-07-14 Hendra . wrote:
 I need a mail server with a catch-all address but limit the recipient
 pattern to -keyw...@example.com, and forward it to an existing
 local account.
 The -keyw...@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 -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


Re: Negation in header_checks doesn't work as expected?

2010-07-14 Thread Tom Hendrikx
On 14/07/10 06:11, Hendra . wrote:
 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 -keyw...@example.com, and forward it to an existing
 local account.
 The -keyw...@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 -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
 

It looks like this could be solved more easily with a recipient
delimiter and maybe some minor changes on the address generation side to
deliver mail to keyword+...@example.com to mailbox keyw...@example.com
automatically.

See http://www.postfix.org/postconf.5.html#recipient_delimiter

Regards,
Tom


Negation in header_checks doesn't work as expected?

2010-07-13 Thread Hendra .
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 -keyw...@example.com, and forward it to an existing
local account.
The -keyw...@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 -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