Wietse:
> Would it be possible to describe the problem that you are trying
> to solve, instead of your solution (routing <> senders differently).
> It is an uncommon requirement. Arbitrary routing requires a procedural
> language, which is currently not included with Postfix.

Fabio Sangiovanni:
> Yes, the problem is the following:
> [the same solution]

This requires a different routing model than what Postfix currently
implements. Postfix's trivial-rewrite program basically runs one
address (sender or recipient) through a sequence of table lookups,
without much regard to other message properties. The trivial-rewrite
program is designed to be replaced by a less trivial program, but
sofar that replacement has not materialized.

That means your solution can currently be implemented only with
less than elegant solutions.

To make the point clear, below is a single Postfix configuration
that rewrites selected addresses when the sender is not <>.  It
uses a sender-dependent FILTER action to enable/disable address
rewriting with smtp_generic_maps, and loops mail back into Postfix
via a mechanism that was designed for external content filters.

/etc/postfix/main.cf:
    smtpd_sender_restrictions = pcre:/etc/postfix/sender_access
    # Default: enable smtp_generic_maps address rewriting.
    content_filter = smtp-with-generic:127.0.0.1:10025

/etc/postfix/sender_access:
    # Override: disable smtp_generic_maps address rewriting.
    /<>/        FILTER smtp-no-generic:127.0.0.1:10025

/etc/postfix/master.cf:
    # smtp-no-generic is included for clarity. You could use "smtp" instead.
    smtp-no-generic  unix  -       -       n       -       -       smtp
        -o smtp_generic_maps=
    smtp-with-generic  unix  -       -       n       -       -       smtp
        -o smtp_generic_maps=hash:/etc/postfix/generic
    127.0.0.1:10025    inet  n       -       n       -       -       smtpd
        -o receive_override_options=no_address_mappings

/etc/postfix/generic:
    us...@example.com   anoth...@example.org

Now, this looks like a pretty compact configuration. The problem
is that a) it is unlikely that real people would come up with stuff
like this and b) solutions that rely on multiple parts (here, FILTER
and smtp_generic_maps) tend to fall apart when requirements change.

In the end, it appears that the more verbose configuration language
wins.

        Wietse

Reply via email to