On 5/21/2015 6:08 AM, Edgaras Lukoševičius wrote:
> Hello,
> 
> some of the recipients have multiple aliases. Let’s say 10. If they receive 
> email, aliases are expanded and one message is divided to 10. So instead of 1 
> there is 10 messages for content filter.
> 
> How can I make postfix expand aliases only after content filter or, if 
> content filter is not triggered, expand immediately?

Alias expansion is not conditional.

Probably your best choice is to disable alias expansion before the
content_filter, and expand aliases in the reinjection postfix listener.

You can set main.cf "content_filter = relay:[127.0.0.1]:10026" so
that mail that doesn't trigger the FILTER goes directly to the
postfix reinjection listener.  This will cause an extra hop, but
won't do any filtering.



  -- Noel Jones


> 
> # /etc/postfix/main.cf
> smtpd_recipient_restrictions =
>                         <…>
>                         check_recipient_access 
> proxy:mysql:/etc/postfix/mysql/filter_recipient_domains.cf
>                         <…>
> 
> # /etc/postfix/mysql/filter_recipient_domains.cf
> <…>
> query = SELECT 'FILTER mailscan:[127.0.0.1]:10025' FROM mailbox WHERE 
> username='%s' active = 1 AND suspended = 0 LIMIT 1
> 
> 
> I could add no_address_mappings for smtpd and then enable address_mappings 
> for mailscan service, but then, if recipient won’t trigger mailscan service, 
> alias won’t be ever expanded.
> 
> 
> 
> May 21 11:02:11 62B6AB81D2D: filter: RCPT from 
> mail.google.com[209.85.212.175]: <t...@domain.tld>: Recipient address 
> triggers FILTER mailscan:[127.0.0.1]:10025; from=<g...@gmail.com> 
> to=<t...@domain.tldt> proto=ESMTP helo=<mail.google.com>
> May 21 11:02:12 mailscan/smtp[31794]: 62B6AB81D2D: to=<ali...@domain.tld>, 
> orig_to=<t...@domain.tld>, relay=127.0.0.1[127.0.0.1]:10025, status=sent (250 
> MAILSCAN(): 2.0.0 Ok: queued as 4A6F4B81D0F)
> May 21 11:02:12 mailscan/smtp[17210]: 62B6AB81D2D: to=<ali...@domain.tld>, 
> orig_to=<t...@domain.tld>, relay=127.0.0.1[127.0.0.1]:10025, status=sent (250 
> MAILSCAN(): 2.0.0 Ok: queued as E29C6B81D26)
> 

Reply via email to