On Friday 13 January 2012 01:10:41 Morten Frederik Kallesøe wrote:
> I think you misunderstood the direction of the mail i want to
> limit. i wanted to limit "To" and not "From"

Your original attempt was check_sender_access which checks the 
envelope sender address. To lookup the recipient address, use 
check_recipient_access. Neither one examines addresses in the headers 
(and in fact, there is no such check_*_access functionality which 
does.)

> I went with the header_checks solution
> 
> cat /etc/postfix/header_checks
> IF /To:/
> !/(@a\.dk|@b\.dk|@c\.dk)/ REJECT Trying to send to domain thats not
> whitelisted ENDIF
> 
> Works like i want. I know there is a performance penalty with the
> pcre instead of hash tables, but its very development server, so
> the traffic is very very low.
> 
> It works, thanks.

It works unless no To: header is specified, or the To: header doesn't 
show the actual intended recipient. Mail headers do not control mail 
routing, and it seems that you are trying to control routing.

It breaks if a header contains the string "To:". You did not anchor 
your expression, i.e., "IF /^To:/" to anchor to the beginning of the 
line.
-- 
  http://rob0.nodns4.us/ -- system administration and consulting
  Offlist GMX mail is seen only if "/dev/rob0" is in the Subject:

Reply via email to