email builder:
> What I ran into while solving the add-a-header issue (see my last
> post on this thread) was that I can use a FILTER action from a
> smtpd_*_restriction check to select a specialized smtp process
> that is bound to a given IP address.
> 
> 
> I found, however, that the FILTER action's nexthop field could
> not be left blank (without a colon, the action is ignored;

This is incorrect. If the ':' is not present in the FILTER argument,
all Postfix versions before 2.7 will use a nexthop of $myhostname:

This code appears in Postfix 2.6, 2.5, 2.4, 2.3 and earlier, file
qmgr_message.c. Here, message->filter_xport is the FILTER argument
(transport, transport: or transport:destination):

        else if (message->filter_xport
                 && (message->tflags & DEL_REQ_TRACE_ONLY_MASK) == 0) {
            reply.flags = 0;
            vstring_strcpy(reply.transport, message->filter_xport);
            if ((nexthop = split_at(STR(reply.transport), ':')) == 0
                || *nexthop == 0)
                nexthop = var_myhostname;
            vstring_strcpy(reply.nexthop, nexthop);
            vstring_strcpy(reply.recipient, recipient->address);

> with a colon but nothing after it, I got name service errors in
> my mail log).

This is incorrect. FILTER actions without ":" have the same effect
as FILTER actions with ":" followed by an empty destination.  

- In both cases, all Postfix before version 2.7 will use a destination
of $myhostname.

- In both cases, Postfix 2.7 and later will use the recipient's
domain instead. That is the change that I made in January 2010.

> The hack to resolve that seemed to be to change the restriction
> check to be check_client_access so I could get at the recipient
> email address and parse off its domain to hand to the FILTER
> nexthop field.

This is incorrect. If you use the FILTER action in smtpd_*_restrictions
then that action has the same effect no matter if you use in client
restrictions, helo restrictions, and so on. Provided of course that
the information you need is available.

The following is an example where information that you need is not
available.

> -o smtpd_data_restrictions=check_client_access,pcre:/etc/postfix/send_to_smtp2
> 
> /etc/postfix/send_to_smtp2:
>    /@(.+)/   FILTER smtp2:$1

That is incorrect.  As documented, check_client_access uses the
CLIENT IP ADDRESS, not the sender or recipient EMAIL ADDRESS.
http://www.postfix.org/postconf.5.html#check_client_access

        Wietse

Reply via email to