On Mon, Mar 31, 2025 at 04:32:07PM -0400, BuzzSaw Code via Postfix-users wrote:

> When someone sends email to one of a list of a few hundred email
> aliases, we would like to add some headers to help drive some of our
> internal processes associated with those aliases.  These would only be
> added fot those specific aliases, not for every email.

If the content of those headers is fixed, or at depends only on the
envelope recipient (messages that mention the aliases in only headers,
and not in the envelope, aren't sent "to" those aliases), this is
not difficult.

For example, I tested:

    smtpd_restriction_classes =
            prepend, prepend1, prepend2, prepend3

    # These could be "check_recipient_access", possibly use LDAP and
    # could interpolate the recipient address into the header.
    #
    prepend1 = check_client_access static:{PREPEND X-Prepend1: foo}
    prepend2 = check_client_access static:{PREPEND X-Prepend2: bar}
    prepend3 = check_client_access static:{PREPEND X-Prepend2: baz}

    prepend = prepend1, prepend2, prepend3

    smtpd_recipient_restrictions =
        # Test from a client not listed in mynetworks!
        permit_mynetworks,
        reject_unauth_destination,
        check_recipient_access inline:{ { test-user@$mydomain = prepend } }
        ...

And received a message:

    ...
    X-Prepend1: foo
    X-Prepend2: bar
    X-Prepend2: baz
    Received: from ... (... [...])
            (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
            key-exchange X25519MLKEM768)
            (No client certificate requested)
            by ... (Postfix) with ESMTPS id 01D0386950B
            for <test-user@...>; Tue, 01 Apr 2025 11:53:03 +1100 (AEDT)
    ...

-- 
    Viktor.
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to