divert(-1) dnl # This has been tested only for 8.12.1 - 8.13.0. The patch is likely dnl # wrong for other versions. dnl # This hack is intended to allow sender based routing. It presupposes dnl # that mailertable is defined. Use a mailertable entry of the form dnl # From:sender@hostname esmtp:host.dom.ain dnl # or dnl # From:hostname esmtp:host.dom.ain dnl # If the sender address/domain is as given, then that relay will be dnl # chosen for the message. If the sender address $f has no dnl # "@domain" component, then $j is used. dnl # dnl # In order for this to work, the patch at the end of this file dnl # must be applied to cf/m4/proto.m4 dnl # dnl # You can usually apply the patch by changing to the "cf/m4" dnl # subdirectory -- the one ontaining proto.m4. Then use the dnl # command: patch < ../hack/sender_based_routing.m4 dnl # divert(0)dnl VERSIONID(`$Id: sender_based_routing.m4,v 1.1.0.2 2004/06/20 18:52:16 rickert Exp $') divert(-1) ifdef(`_MAILER_TABLE_',,dnl `errprint(`Warning: sender_based_routing requires mailertable ')')dnl define(`_SENDER_BASED_ROUTING_')dnl dnl`'The remainder of this file is a patch to be applied to dnl`'cf/mp/proto.m4. The patch is preceded by some "ifdef" dnl`'contortions to try to prevent M4 from expanding it if it is dnl`'left at the end of this HACK file. dnl`' dnl`' If you want to delete the patch from this file, delete dnl`' everything following this line. dnl`' divert(-1) ifdef(`_SENDER_BASED_ROUTING_',, ``` dnl`' multiple quoting to make sure nothing is expanded --- proto.m4 2004/06/06 01:15:48 1.1 +++ proto.m4 2004/06/20 18:37:33 @@ -1121,6 +1121,15 @@ ifdef(`_MAILER_TABLE_', `dnl # not local -- try mailer table lookup +ifdef(`_SENDER_BASED_ROUTING_', `dnl +R$+ <@ $+ > $:$&f@$j<>$1<@$2> prepend local sender +R$+@$+@$j<>$+<@$+> $:$1@$2<>$3<@$4> avoid duplicate domain +R$+@$+<>$+<@$+> $:$(mailertable From:$1@$2 $:@$2 $)<>$3<@$4> +R$*@$+.$+<>$+<@$+> $:$(mailertable From:$2.$3 $@$1 $:$1$2@.$3 $)<>$4<@$5> +R$*@$+<>$+<@$+> $:$(mailertable From:$2 $@$1 $: $)<>$3<@$4> +R$-:$+<>$+ $@$>MailerToTriple <$1 : $2> $3 +R$*<>$+<$+> $:$2 <$3> +')dnl ## end _SENDER_BASED_ROUTING_ R$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host name R< $+ . > $* $: < $1 > $2 strip trailing dot R< $+ > $* $: < $(mailertable $1 $) > $2 lookup '''')dnl`' This line and the preceding will be seen as fuzz in patching. dnl`' we have to deal with unbalanced quotes in the patch.