On Mon, Dec 30, 2019 at 12:46:50AM -0800, Stats Student wrote:

> 1) receive messages for users in a Postgres database and hand those
> messages to an external script for processing (no traditional
> mailstore). The server handles mail for only one domain.
> 
> 2) for a handful of accounts (postmaster, help, root), the messages
> should be forwarded to another address (different domain).

This is easily handled via virtual_alias_maps, rewriting the recipients in
question.

> Would be great for this forwarding to take place without going through the
> processing script in (1).

Virtual alias rewriting happens before message delivery.  Note
that the domain need not be configured as a virtual alias domain,
virtual alias rewriting happens for all recipients, regardless
of address class.

> A very long time ago, I had it working with content_filter (as
> described in http://www.postfix.org/FILTER_README.html#advanced_filter)
> and virtual_alias_maps.

That's unnecessary, a pipe(8) transport is just fine, unless the mail is
going back into Postfix after processing by the script.

> But for some reason (receive_override_options = no_address_mappings)
> causes the server to ignore users in virtual_alias_maps and bounce.

Well, that's simply not how Postfix works, when you have a
content_filter.  The bounce only happens with no_address_mappings in
combination with NO content_filter.  But, you don't need either a filter
or no_address_mappings.

> What's the best way to get this configured? Would appreciate specific
> setup recommendations (relay vs virtual aliases, content_filter, etc).
> Happy to provide additional details.

Rewrite the exempt users to a different domain, resolve the original
domain to a pipe(8) transport that runs the script.  Provided the script
does not re-inject modified email back into Postfix with the same
recipient domain.

-- 
    Viktor.

Reply via email to