Wietse Venema:
> If you really want no relayhost for a list of senders, this is not
> easily done with Postfix.  sender_dependent_relayhost_maps was
> designed to do the exact opposite: specify a relayhost for a list
> of senders.
> 
> If the sender list is REALLY small, you could use the pcre built-in
> negation operator:
> 
> /etc/postfix/main.cf:
>      relayhost =
>      sender_dependent_relayhost_maps = pcre:/etc/postfix/sender_relay.pcre
> 
> /etc/postfix/sender_relay.pcre:
>      if !/[EMAIL PROTECTED]/
>      if !/[EMAIL PROTECTED]/
>      /./ [my.isp.com]
>      endif
>      endif
> 
> This sends mail from everyone but a few to [my.isp.com], but this
> approach becomes unwieldy if you need to specify many senders.
> 
> Of course we could introduce a hack where a special lookup result
> of "NONE" (or some other magic string) means don't use a relayhost.
> 
> Postfix would then look like this:
> 
> /etc/postfix/main.cf:
>      relayhost =
>      sender_dependent_relayhost_maps = 
>       hash:/etc/postfix/sender_relay static:[my.isp.com]
> 
> /etc/postfix/sender_relay:
>      [EMAIL PROTECTED]        none
>      [EMAIL PROTECTED]        none
> 
> which is much cleaner.
> 
> Introducing "NONE" (or whatever) requires a source code change.
> It also will raise expectations: people will try to use it in other
> tables and be disappointed that it does not work there, just like
> you tried to use "smtp:" in a place where Postfix expects "host"
> or "host:port".

There is prior art in Postfix with magic lookup results. 

For example, header_checks allows you to search a list of tables.
When a table returns a result of DUNNO, Postfix stops searching
and behaves as if the result is "not found".

In my last example above, support for DUNNO (instead of "none")
would also solve the problem.  There is no need to introduce a new
magic lookup result, just one line of code that works in the same
way as people already know from elsewhere in Postfix.

        Wietse

*** ./src/trivial-rewrite/resolve.c-    Wed Dec 12 19:23:26 2007
--- ./src/trivial-rewrite/resolve.c     Fri Oct  3 11:20:22 2008
***************
*** 511,517 ****
                && (relay = mail_addr_find(rp->snd_relay_info, *sender ?
                                           sender : var_null_relay_maps_key,
                                           (char **) 0)) != 0)
!               vstring_strcpy(nexthop, relay);
            else if (*RES_PARAM_VALUE(rp->relayhost))
                vstring_strcpy(nexthop, RES_PARAM_VALUE(rp->relayhost));
            else
--- 511,518 ----
                && (relay = mail_addr_find(rp->snd_relay_info, *sender ?
                                           sender : var_null_relay_maps_key,
                                           (char **) 0)) != 0)
!               vstring_strcpy(nexthop, strcasecmp(relay, "DUNNO") == 0 ?
!                              rcpt_domain : relay);
            else if (*RES_PARAM_VALUE(rp->relayhost))
                vstring_strcpy(nexthop, RES_PARAM_VALUE(rp->relayhost));
            else

Reply via email to