BSD 4_4 release
[unix-history] / usr / src / usr.sbin / sendmail / cf / m4 / proto.m4
index f74301f..846cc16 100644 (file)
@@ -1,49 +1,95 @@
 divert(-1)
 #
 # Copyright (c) 1983 Eric P. Allman
 divert(-1)
 #
 # Copyright (c) 1983 Eric P. Allman
-# Copyright (c) 1988 The Regents of the University of California.
-# All rights reserved.
+# Copyright (c) 1988, 1993
+#      The Regents of the University of California.  All rights reserved.
 #
 #
-# %sccs.include.redist.sh%
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#      This product includes software developed by the University of
+#      California, Berkeley and its contributors.
+# 4. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
 #
 divert(0)
 
 #
 divert(0)
 
-VERSIONID(`@(#)proto.m4        6.14 (Berkeley) %G%')
+VERSIONID(`@(#)proto.m4        8.1 (Berkeley) 6/27/93')
 
 MAILER(local)dnl
 
 
 MAILER(local)dnl
 
-ifdef(`_OLD_SENDMAIL_', `dnl',
+ifdef(`_OLD_SENDMAIL_',
+`define(`_SET_96_', 6)dnl
+define(`_SET_97_', 7)dnl',
 `# level 4 config file format
 `# level 4 config file format
-V4')
+V4
+define(`_SET_96_', 96)dnl
+define(`_SET_97_', 97)dnl')
 
 ##################
 #   local info   #
 ##################
 
 
 ##################
 #   local info   #
 ##################
 
+CP.
+
 Cwlocalhost
 ifdef(`USE_CW_FILE',
 `# file containing names of hosts for which we receive email
 Cwlocalhost
 ifdef(`USE_CW_FILE',
 `# file containing names of hosts for which we receive email
-Fw/etc/sendmail.cw', `dnl')
+CONCAT(`Fw', confCW_FILE)', `dnl')
 
 ifdef(`UUCP_RELAY',
 `# UUCP relay host
 CONCAT(DY, UUCP_RELAY)
 
 ifdef(`UUCP_RELAY',
 `# UUCP relay host
 CONCAT(DY, UUCP_RELAY)
+CPUUCP
 
 ')dnl
 ifdef(`BITNET_RELAY',
 `#  BITNET relay host
 CONCAT(DB, BITNET_RELAY)
 
 ')dnl
 ifdef(`BITNET_RELAY',
 `#  BITNET relay host
 CONCAT(DB, BITNET_RELAY)
+CPBITNET
 
 ')dnl
 ifdef(`CSNET_RELAY',
 `# CSNET relay host
 CONCAT(DC, CSNET_RELAY)
 
 ')dnl
 ifdef(`CSNET_RELAY',
 `# CSNET relay host
 CONCAT(DC, CSNET_RELAY)
+CPCSNET
+
+')dnl
+ifdef(`FAX_RELAY',
+`# FAX relay host
+CONCAT(DF, FAX_RELAY)
+CPFAX
 
 ')dnl
 ifdef(`SMART_HOST',
 `# "Smart" UUCP relay host
 CONCAT(DS, SMART_HOST)
 
 
 ')dnl
 ifdef(`SMART_HOST',
 `# "Smart" UUCP relay host
 CONCAT(DS, SMART_HOST)
 
+')dnl
+ifdef(`MAILER_TABLE',
+`# Mailer table (overriding domains)
+Kmailertable MAILER_TABLE
+
 ')dnl
 # who I send unqualified names to (null means deliver locally)
 CONCAT(DR, ifdef(`LOCAL_RELAY', LOCAL_RELAY))
 ')dnl
 # who I send unqualified names to (null means deliver locally)
 CONCAT(DR, ifdef(`LOCAL_RELAY', LOCAL_RELAY))
@@ -69,6 +115,11 @@ CO @ % ifdef(`_NO_UUCP_', `', `!')
 # a class with just dot (for identifying canonical names)
 C..
 
 # a class with just dot (for identifying canonical names)
 C..
 
+ifdef(`_OLD_SENDMAIL_', `dnl',
+`# dequoting map
+Kdequote dequote')
+
+undivert(6)dnl
 
 ######################
 #   Special macros   #
 
 ######################
 #   Special macros   #
@@ -95,8 +146,8 @@ include(`../m4/version.m4')
 #   Options   #
 ###############
 
 #   Options   #
 ###############
 
-# preserve 8 bits on message body on input?
-CONCAT(O8, confEIGHT_BIT_INPUT)
+# strip message body to 7 bits on input?
+CONCAT(O7, confSEVEN_BIT_INPUT)
 
 # wait (in minutes) for alias file rebuild
 CONCAT(Oa, confALIAS_WAIT)
 
 # wait (in minutes) for alias file rebuild
 CONCAT(Oa, confALIAS_WAIT)
@@ -124,12 +175,12 @@ CONCAT(OD, confAUTO_REBUILD)
 
 # error message header/file */
 ifdef(`confERROR_MESSAGE',
 
 # error message header/file */
 ifdef(`confERROR_MESSAGE',
-       concat(OE, confERROR_MESSAGE),
+       CONCAT(OE, confERROR_MESSAGE),
        #OE/etc/sendmail.oE)
 
 # error mode
 ifdef(`confERROR_MODE',
        #OE/etc/sendmail.oE)
 
 # error mode
 ifdef(`confERROR_MODE',
-       concat(Oe, confERROR_MODE),
+       CONCAT(Oe, confERROR_MODE),
        #Oep)
 
 # save Unix-style "From_" lines at top of header?
        #Oep)
 
 # save Unix-style "From_" lines at top of header?
@@ -158,6 +209,9 @@ ifdef(`confBIND_OPTS',
        CONCAT(OI, confBIND_OPTS),
        #OI)
 
        CONCAT(OI, confBIND_OPTS),
        #OI)
 
+# deliver MIME-encapsulated error messages?
+CONCAT(Oj, confMIME_FORMAT_ERRORS)
+
 # Forward file search path
 ifdef(`confFORWARD_PATH',
        CONCAT(OJ, confFORWARD_PATH),
 # Forward file search path
 ifdef(`confFORWARD_PATH',
        CONCAT(OJ, confFORWARD_PATH),
@@ -169,6 +223,9 @@ CONCAT(Ok, confMCI_CACHE_SIZE)
 # open connection cache timeout
 CONCAT(OK, confMCI_CACHE_TIMEOUT)
 
 # open connection cache timeout
 CONCAT(OK, confMCI_CACHE_TIMEOUT)
 
+# use Errors-To: header?
+CONCAT(Ol, confUSE_ERRORS_TO)
+
 # log level
 CONCAT(OL, confLOG_LEVEL)
 
 # log level
 CONCAT(OL, confLOG_LEVEL)
 
@@ -181,6 +238,11 @@ CONCAT(On, confCHECK_ALIASES)
 # default messages to old style headers if no special punctuation?
 CONCAT(Oo, confOLD_STYLE_HEADERS)
 
 # default messages to old style headers if no special punctuation?
 CONCAT(Oo, confOLD_STYLE_HEADERS)
 
+# SMTP daemon options
+ifdef(`confDAEMON_OPTIONS',
+       CONCAT(OO, confDAEMON_OPTIONS),
+       #OOPort=esmtp)
+
 # privacy flags
 CONCAT(Op, confPRIVACY_FLAGS)
 
 # privacy flags
 CONCAT(Op, confPRIVACY_FLAGS)
 
@@ -223,7 +285,12 @@ ifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot',
 CONCAT(Ou, confDEF_USER_ID)
 
 # list of locations of user database file (null means no lookup)
 CONCAT(Ou, confDEF_USER_ID)
 
 # list of locations of user database file (null means no lookup)
-CONCAT(OU, ifdef(`USERDB_SPEC', `USERDB_SPEC'))
+OU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC')
+
+# fallback MX host
+ifdef(`confFALLBACK_MX',
+       CONCAT(OV, confFALLBACK_MX),
+       #OVfall.back.host.net)
 
 # load average at which we just queue messages
 CONCAT(Ox, confQUEUE_LA)
 
 # load average at which we just queue messages
 CONCAT(Ox, confQUEUE_LA)
@@ -271,8 +338,8 @@ Tuucp
 #   Format of headers   #
 #########################
 
 #   Format of headers   #
 #########################
 
-H?P?Return-Path: <$?<$<$|$g$.>
-HReceived: $?sfrom $s $.by $j ($v/$Z) id $i; $b
+H?P?Return-Path: $g
+HReceived: $?sfrom $s $.$?_($_) $.by $j ($v/$Z)$?r with $r$. id $i; $b
 H?D?Resent-Date: $a
 H?D?Date: $a
 H?F?Resent-From: $q
 H?D?Resent-Date: $a
 H?D?Date: $a
 H?F?Resent-From: $q
@@ -283,7 +350,6 @@ HSubject:
 # H?l?Received-Date: $b
 H?M?Resent-Message-Id: <$t.$i@$j>
 H?M?Message-Id: <$t.$i@$j>
 # H?l?Received-Date: $b
 H?M?Resent-Message-Id: <$t.$i@$j>
 H?M?Message-Id: <$t.$i@$j>
-undivert(6)dnl
 #\f
 ######################################################################
 ######################################################################
 #\f
 ######################################################################
 ######################################################################
@@ -293,63 +359,68 @@ undivert(6)dnl
 ######################################################################
 ######################################################################
 
 ######################################################################
 ######################################################################
 
+undivert(9)dnl
 
 ###########################################
 ###  Rulset 3 -- Name Canonicalization  ###
 ###########################################
 S3
 
 
 ###########################################
 ###  Rulset 3 -- Name Canonicalization  ###
 ###########################################
 S3
 
-# handle null input (translate to <> special case)
-R$@                    $@ <>
+# handle null input and list syntax (translate to <@> special case)
+R$@                    $@ <@>
+R$*:;$*                        $@ $1 :; <@>
 
 # basic textual canonicalization -- note RFC733 heuristic here
 R$*<$*>$*<$*>$*                <$2>$3$4$5                      strip multiple <> <>
 R$*<$*<$+>$*>$*                <$3>$5                          2-level <> nesting
 
 # basic textual canonicalization -- note RFC733 heuristic here
 R$*<$*>$*<$*>$*                <$2>$3$4$5                      strip multiple <> <>
 R$*<$*<$+>$*>$*                <$3>$5                          2-level <> nesting
-R$*<>$*                        $@ <                          MAIL FROM:<> case
+R$*<>$*                        $@ <@>                          MAIL FROM:<> case
 R$*<$+>$*              $2                              basic RFC821/822 parsing
 
 # make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
 R@ $+ , $+             @ $1 : $2                       change all "," to ":"
 
 # localize and dispose of route-based addresses
 R$*<$+>$*              $2                              basic RFC821/822 parsing
 
 # make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
 R@ $+ , $+             @ $1 : $2                       change all "," to ":"
 
 # localize and dispose of route-based addresses
-R@ $+ : $+             $@ $>6 < @$1 > : $2             handle <route-addr>
+R@ $+ : $+             $@ $>_SET_96_ < @$1 > : $2              handle <route-addr>
 
 # find focus for list syntax
 
 # find focus for list syntax
-R $+ : $* ; @ $+       $@ $>6 $1 : $2 ; < @ $3 >       list syntax
+R $+ : $* ; @ $+       $@ $>_SET_96_ $1 : $2 ; < @ $3 >        list syntax
 R $+ : $* ;            $@ $1 : $2;                     list syntax
 
 # find focus for @ syntax addresses
 R$+ @ $+               $: $1 < @ $2 >                  focus on domain
 R$+ < $+ @ $+ >                $1 $2 < @ $3 >                  move gaze right
 R $+ : $* ;            $@ $1 : $2;                     list syntax
 
 # find focus for @ syntax addresses
 R$+ @ $+               $: $1 < @ $2 >                  focus on domain
 R$+ < $+ @ $+ >                $1 $2 < @ $3 >                  move gaze right
-R$+ < @ $+ >           $@ $>6 $1 < @ $2 >              already canonical
+R$+ < @ $+ >           $@ $>_SET_96_ $1 < @ $2 >               already canonical
 
 ifdef(`_NO_UUCP_', `dnl',
 `# convert old-style addresses to a domain-based address
 
 ifdef(`_NO_UUCP_', `dnl',
 `# convert old-style addresses to a domain-based address
-R$- ! $+               $@ $>6 $2 < @ $1 .UUCP >        resolve uucp names
-R$+ . $- ! $+          $@ $>6 $3 < @ $1 . $2 >         domain uucps
-R$+ ! $+               $@ $>6 $2 < @ $1 .UUCP >        uucp subdomains')
+R$- ! $+               $@ $>_SET_96_ $2 < @ $1 .UUCP > resolve uucp names
+R$+ . $- ! $+          $@ $>_SET_96_ $3 < @ $1 . $2 >          domain uucps
+R$+ ! $+               $@ $>_SET_96_ $2 < @ $1 .UUCP > uucp subdomains')
 
 # if we have % signs, take the rightmost one
 R$* % $*               $1 @ $2                         First make them all @s.
 R$* @ $* @ $*          $1 % $2 @ $3                    Undo all but the last.
 
 # if we have % signs, take the rightmost one
 R$* % $*               $1 @ $2                         First make them all @s.
 R$* @ $* @ $*          $1 % $2 @ $3                    Undo all but the last.
-R$* @ $*               $@ $>6 $1 < @ $2 >              Insert < > and finish
+R$* @ $*               $@ $>_SET_96_ $1 < @ $2 >               Insert < > and finish
 
 # else we must be a local name
 
 
 
 # else we must be a local name
 
 
-###############################################
-###  Ruleset 6 -- bottom half of ruleset 3  ###
-###############################################
+################################################
+###  Ruleset _SET_96_ -- bottom half of ruleset 3  ###
+################################################
 
 #  At this point, everything should be in a "local_part<@domain>extra" format.
 
 #  At this point, everything should be in a "local_part<@domain>extra" format.
-S6
+S`'_SET_96_
 
 # handle special cases for local names
 
 # handle special cases for local names
-R$* < @ $=w > $*               $: $1 < @ $j . > $3             no domain at all
-R$* < @ $=w . UUCP > $*                $: $1 < @ $j . > $3             .UUCP domain
+R$* < @ localhost > $*         $: $1 < @ $j . > $2             no domain at all
+R$* < @ localhost . $m > $*    $: $1 < @ $j . > $2             local domain
+ifdef(`_NO_UUCP_', `dnl',
+`R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2             .UUCP domain')
 undivert(2)dnl
 
 undivert(2)dnl
 
-ifdef(`UUCP_RELAY',
+ifdef(`_NO_UUCP_', `dnl',
+`ifdef(`UUCP_RELAY',
 `# pass UUCP addresses straight through
 R$* < @ $+ . UUCP > $*         $@ $1 < @ $2 . UUCP > $3',
 `# if really UUCP, handle it immediately
 `# pass UUCP addresses straight through
 R$* < @ $+ . UUCP > $*         $@ $1 < @ $2 . UUCP > $3',
 `# if really UUCP, handle it immediately
@@ -369,13 +440,13 @@ R$* < @ $+ . UUCP > $*            $: $1 < @ $[ $2 $] . UUCP > $3
 ifdef(`_OLD_SENDMAIL_',
 `R$* < @ $+ . $+ . UUCP > $*           $@ $1 < @ $2 . $3 . > $4',
 `R$* < @ $+ . . UUCP > $*              $@ $1 < @ $2 . > $3')')
 ifdef(`_OLD_SENDMAIL_',
 `R$* < @ $+ . $+ . UUCP > $*           $@ $1 < @ $2 . $3 . > $4',
 `R$* < @ $+ . . UUCP > $*              $@ $1 < @ $2 . > $3')')
+')
+ifdef(`_NO_CANONIFY_',
+`# make sure local host names appear canonical
+R$* < @ $=w > $*               $: $1 < @ $2 . > $3',
+`# pass to name server to make hostname canonical
+R$* < @ $* $~P > $*            $: $1 < @ $[ $2 $3 $] > $4')
 
 
-# pass to name server to make hostname canonical
-R$* < @ $* $~. > $*            $: $1 < @ $[ $2 $3 $] > $4
-
-# handle possible alternate names
-R$* < @ $=w . $m . > $*                $: $1 < @ $j . > $3
-R$* < @ $=w . $m > $*          $: $1 < @ $j . > $3
 undivert(8)dnl
 
 # if this is the local hostname, make sure we treat is as canonical
 undivert(8)dnl
 
 # if this is the local hostname, make sure we treat is as canonical
@@ -387,7 +458,7 @@ R$* < @ $j > $*                     $: $1 < @ $j . > $2
 ##################################################
 S4
 
 ##################################################
 S4
 
-R<>                    $@                              handle <> error addr
+R$*<@>                 $@ $1                           handle <> and list:;
 
 # resolve numeric addresses to name if possible
 R$* < @ [ $+ ] > $*    $: $1 < @ $[ [$2] $] > $3       lookup numeric internet addr
 
 # resolve numeric addresses to name if possible
 R$* < @ [ $+ ] > $*    $: $1 < @ $[ [$2] $] > $3       lookup numeric internet addr
@@ -409,12 +480,12 @@ R$+ % $=w @ $=w           $1 @ $j                         u%host@host => u@host
 
 
 
 
 
 
-#############################################################
-###   Ruleset 7 -- recanonicalize and call ruleset zero   ###
-###               (used for recursive calls)             ###
-#############################################################
+##############################################################
+###   Ruleset _SET_97_ -- recanonicalize and call ruleset zero   ###
+###               (used for recursive calls)              ###
+##############################################################
 
 
-S7
+S`'_SET_97_
 R$*                    $: $>3 $1
 R$*                    $@ $>0 $1
 
 R$*                    $: $>3 $1
 R$*                    $@ $>0 $1
 
@@ -425,7 +496,8 @@ R$*                 $@ $>0 $1
 
 S0
 
 
 S0
 
-R<>                    $#local $: <>                   special case error msgs
+R<@>                   $#local $: <>                   special case error msgs
+R$*:;<@>               $#error $@ USAGE $: "list:; syntax illegal for recipient addresses"
 
 ifdef(`_MAILER_smtp_',
 `# handle numeric address spec
 
 ifdef(`_MAILER_smtp_',
 `# handle numeric address spec
@@ -434,21 +506,35 @@ R$* < @ [ $+ ] > $*       $#smtp $@ [$2] $: $1 @ [$2] $3  numeric internet spec',
 `dnl')
 
 # now delete the local info -- note $=O to find characters that cause forwarding
 `dnl')
 
 # now delete the local info -- note $=O to find characters that cause forwarding
-R< @ $j . > : $*       $@ $>7 $1                       @here:... -> ...
-R$* $=O $* < @ $j . >  $@ $>7 $1 $2 $3                 ...@here -> ...
+R$* < @ > $*           $@ $>_SET_97_ $1                        user@ => user
+R< @ $=w . > : $*      $@ $>_SET_97_ $2                        @here:... -> ...
+R$* $=O $* < @ $=w . > $@ $>_SET_97_ $1 $2 $3                  ...@here -> ...
+ifdef(`MAILER_TABLE',
+`
+# try mailer table lookup
+R$* <@ $+ > $*         $: < $2 > $1 < @ $2 > $3        extract host name
+R< $+ . > $*           $: < $1 > $2                    strip trailing dot
+R< $+ > $*             $: < $(mailertable $1 $) > $2   lookup
+R< $- : $+ > $*                $# $1 $@ $2 $: $3               check -- resolved?
+R< $+ > $*             $: $>90 <$1> $2                 try domain',
+`dnl')
 
 # short circuit local delivery so forwarded email works
 
 # short circuit local delivery so forwarded email works
-R$+ < @ $j . >         $: $1 < @ $j @ $H >             first try hub
+ifdef(`_LOCAL_NOT_STICKY_',
+`R$=L < @ $=w . >              $#local $: @ $1                 special local names
+R$+ < @ $=w . >                $#local $: $1                   dispose directly',
+`R$+ < @ $=w . >               $: $1 < @ $2 @ $H >             first try hub
 ifdef(`_OLD_SENDMAIL_',
 `R$+ < $+ @ $-:$+ >    $# $3 $@ $4 $: $1 < $2 >        yep ....
 ifdef(`_OLD_SENDMAIL_',
 `R$+ < $+ @ $-:$+ >    $# $3 $@ $4 $: $1 < $2 >        yep ....
-R$+ < $+ @ $+ >                $#smtp $@ $3 $: $1 < $2 >       yep ....
+R$+ < $+ @ $+ >                $#relay $@ $3 $: $1 < $2 >      yep ....
 R$+ < $+ @ >           $#local $: $1                   nope, local address',
 `R$+ < $+ @ $+ >               $#local $: $1                   yep ....
 R$+ < $+ @ >           $#local $: $1                   nope, local address',
 `R$+ < $+ @ $+ >               $#local $: $1                   yep ....
-R$+ < $+ @ >           $#local $: @ $1                 nope, local address')
+R$+ < $+ @ >           $#local $: @ $1                 nope, local address')')
 undivert(3)dnl
 undivert(4)dnl
 
 undivert(3)dnl
 undivert(4)dnl
 
-# resolve remotely connected UUCP links (if any)
+ifdef(`_NO_UUCP_', `dnl',
+`# resolve remotely connected UUCP links (if any)
 ifdef(`_CLASS_V_',
 `R$* < @ $=V . UUCP > $*               $#smtp $@ $V $: <@ $V> : $1 @ $2.UUCP $3',
        `dnl')
 ifdef(`_CLASS_V_',
 `R$* < @ $=V . UUCP > $*               $#smtp $@ $V $: <@ $V> : $1 @ $2.UUCP $3',
        `dnl')
@@ -457,7 +543,7 @@ ifdef(`_CLASS_W_',
        `dnl')
 ifdef(`_CLASS_X_',
 `R$* < @ $=X . UUCP > $*               $#smtp $@ $X $: <@ $X> : $1 @ $2.UUCP $3',
        `dnl')
 ifdef(`_CLASS_X_',
 `R$* < @ $=X . UUCP > $*               $#smtp $@ $X $: <@ $X> : $1 @ $2.UUCP $3',
-       `dnl')
+       `dnl')')
 
 # resolve fake top level domains by forwarding to other hosts
 ifdef(`BITNET_RELAY',
 
 # resolve fake top level domains by forwarding to other hosts
 ifdef(`BITNET_RELAY',
@@ -466,13 +552,18 @@ ifdef(`BITNET_RELAY',
 ifdef(`CSNET_RELAY',
 `R$*<@$+.CSNET>$*      $#smtp $@ $C $: $1 <@$2.CSNET> $3       user@host.CSNET',
        `dnl')
 ifdef(`CSNET_RELAY',
 `R$*<@$+.CSNET>$*      $#smtp $@ $C $: $1 <@$2.CSNET> $3       user@host.CSNET',
        `dnl')
+ifdef(`_MAILER_fax_',
+`R$+ < @ $+ .FAX >     $#fax $@ $2 $: $1                       user@host.FAX',
+`ifdef(`FAX_RELAY',
+`R$*<@$+.FAX>$*                $#smtp $@ $F $: $1 <@$2.FAX> $3         user@host.FAX',
+       `dnl')')
 
 ifdef(`UUCP_RELAY',
 `# forward non-local UUCP traffic to our UUCP relay
 R$*<@$*.UUCP>$*                $#smtp $@ $Y $: <@ $Y> : $1 @ $2.UUCP $3        uucp mail',
 `ifdef(`_MAILER_uucp_',
 `# forward other UUCP traffic straight to UUCP
 
 ifdef(`UUCP_RELAY',
 `# forward non-local UUCP traffic to our UUCP relay
 R$*<@$*.UUCP>$*                $#smtp $@ $Y $: <@ $Y> : $1 @ $2.UUCP $3        uucp mail',
 `ifdef(`_MAILER_uucp_',
 `# forward other UUCP traffic straight to UUCP
-R< @ $+ .UUCP > : $+   $#uucp $@ $1 $: $1:$2                   @host.UUCP:...
+R< @ $+ .UUCP > : $+   $#uucp $@ $1 $: $2                      @host.UUCP:...
 R$+ < @ $+ .UUCP >     $#uucp $@ $2 $: $1                      user@host.UUCP',
        `dnl')')
 
 R$+ < @ $+ .UUCP >     $#uucp $@ $2 $: $1                      user@host.UUCP',
        `dnl')')
 
@@ -502,10 +593,15 @@ R$=L                      $#local $: $1                   special local names
 R$+                    $: $1 < @ $R >                  append relay
 R$+ < @ >              $: $1 < @ $H >                  no relay, try hub
 R$+ < @ >              $#local $: $1                   no relay or hub: local
 R$+                    $: $1 < @ $R >                  append relay
 R$+ < @ >              $: $1 < @ $H >                  no relay, try hub
 R$+ < @ >              $#local $: $1                   no relay or hub: local
-R$+ < @ $j  >          $#local $: $1                   we are relay/hub: local
+R$+ < @ $=w  >         $#local $: $1                   we are relay/hub: local
 R$+ < @ $-:$+ >                $# $2 $@ $3 $: $1               deliver to relay/hub
 R$+ < @ $-:$+ >                $# $2 $@ $3 $: $1               deliver to relay/hub
-R$+ < @ $+ >           $#smtp $@ $2 $: $1              deliver to relay/hub',
-`# handle locally delivered names
+R$+ < @ $+ >           $#relay $@ $2 $: $1             deliver to relay/hub',
+
+`# if this is quoted, strip the quotes and try again
+R$+                    $: $(dequote $1 $)              strip quotes
+R$* $=O $*             $@ $>_SET_97_ $1 $2 $3                  try again
+
+# handle locally delivered names
 R$=L                   $#local $: @ $1                 special local names
 R$+                    $#local $: $1                   regular local names
 
 R$=L                   $#local $: @ $1                 special local names
 R$+                    $#local $: $1                   regular local names
 
@@ -516,12 +612,27 @@ R$+                       $#local $: $1                   regular local names
 
 S5
 
 
 S5
 
-ifdef(`_MAILER_smtp_',
-`R$+                   $: $1 < @ $R >
+# see if we have a relay or a hub
+R$+                    $: $1 < @ $R >
 R$+ < @ >              $: $1 < @ $H >                  no relay, try hub
 R$+ < @ >              $: $1 < @ $H >                  no relay, try hub
-R$+ < @ $j >           $@ $1                           we are relay/hub: local
+R$+ < @ $=w >          $@ $1                           we are relay/hub: local
 R$+ < @ $-:$+ >                $# $2 $@ $3 $: $1               send to relay or hub
 R$+ < @ $-:$+ >                $# $2 $@ $3 $: $1               send to relay or hub
-R$+ < @ $+ >           $#smtp $@ $2 $: $1              send to relay or hub')')
+ifdef(`_MAILER_smtp_',
+`R$+ < @ $+ >          $#relay $@ $2 $: $1             send to relay or hub')')
+ifdef(`MAILER_TABLE',
+`
+
+###########################################################################
+###  Ruleset 90 -- try domain part of mailertable entry                ###
+###               (new sendmail only)                                  ###
+###########################################################################
+
+S90
+R<$- . $+ > $*         $: < $(mailertable .$2 $) > $3  lookup
+R<$- : $+ > $*         $# $1 $@ $2 $: $3               check -- resolved?
+R< . $+ > $*           $@ $>90 <$1> $2                 no -- strip & try again
+R<$*> $*               $@ $2                           no match',
+`dnl')
 #\f
 ######################################################################
 ######################################################################
 #\f
 ######################################################################
 ######################################################################