Настройка программы sendmail
При получении почтового сообщения адреса, указанные в полях То, From, Cc преобразуются в соответствии с правилами преобразования.
#####################################
#####
##### REWRITING RULES
#####
#####################################
### Rulset 3 - Name Canonicalization
#####################################
S3
# handle null input (translate to <@> special case)
R$@ $@
<a>
# basic textual canonicalization - note RFC733
heuristic here
R$
*
<$*>
$
*
<$*>
$
*
$2$3
<$4>
$5 strip multiple
<>
<>
R$
*
<$*<$+>
$
*
>
$
*
<$3>
$5 2
-
level о nesting
R$
*
<>
$
*
$@
<a>
MAIL FROM:
<>
case
R$
*
<$+>
$
*
$2 basic RFC821
/
822 parsing
# handle list:; syntax as special case
R$
*
:;$
*
$@ $1:;
"g"
# 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@ $
+
: $
+
$@ $
>
96
< @$1 >
: $2 handle
<route-addr>
# find focus for list syntax
R $
+
: $
*
@ $
+
$@ $
>
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$
+
< @ $+ >
$@ $
>
96 $1
< @ $2 >
already
canonical
# do some sanity checking
R$
*
< @ $*: $* >
$
*
$1
< @ $2 $3 >
$4 nix
colons in addrs
" convert old
-
style addresses to a domain
-
based
address
R$
-
! $
+
$@ $
>
96 $2
< @ $1.UUCP >
resolve uucp
names
R$
+
.$
-
!$
+
$@ $
>
96 $3
< @ $1. $2 >
domain uucps
R$
+
! $
+
$@ $
>
96 $2
< @ $*1.UUCP >
uucp subdo
-
mains
# if we have X signs, take the rightmost one R$* X $* $1 @ $2
First make them all @s. R$
*
@.$
*
@ $
*
$1 X $2 @ $3 Undo all but the last.
R$
*
@ $
*
$@ $
>
96 $1
< @ $2 >
Insert
< >
and finish
# else we must be a local name
##########################################
### Ruleset 96 - bottom half of ruleset 3
##########################################
# At this point, everything should be in a "local_part<@domain>extra" format.
S96
# handle special cases for local names
R$
*
< @ localhost >
$
*
$: $1
< @ $j. >
$2
no domain at all
R$
*
< @ localhost. $m >
$
*
$: $1
< @ $j. >
$2 local domain
R$
*
< @ localhost. UUCP >
$
*
$: $1
< @ $j. >
$2.UUCP domain
R$
*
< @ [$+]>
$
*
$: $1
< @@ [ $2 ] >
$3
mark [a.b.c.d]
R$
*
< @@ $=w >
$
*
$: $1
< @ $j. >
$3
self
-
literal
R$
*
< @@ $+ >
$
*
$@ $1
< @ $2 >
$3 canon IP
addr
# pass UUCP addresses straight through
R$
*
< @ $+. UUCP >
$
*
$@ $1
< <s>
$2. UUCP.
>
$3
# pass to name server to make hostname canonical R$* < @ $* $-p > $* $: $1 < @ $[ $2 $3 $] > $4
# local host aliases and pseudo-domains are always
canonical
R$
*
< @ $=w >
$
*
$: $1
< @ $2. >
$3
R$
*
< @ $* $=p >
$
*
$: $1
< @ $2 $3. >
$4
R$
*
< @ $*..>
$
*
$1
< @ $2. >
$3
tf if this is the local hostname, make sure we
treat is as canonical
R$
*
< @ $j >
$
*
$: $1
< § $j. >
$2
#############################################
### Ruleset 4 Final Output Post-rewriting ###
#############################################
S4
R$
*
<@>
$@ $1 handle
<>
and list:;
# strip trailing dot off possibly canonical name R$* < @ $+. > $* $1 < @ $2 > $3
# externalize local domain info
R$
*
<$+>
$
*
$1 $2 $3 defocus R@ $
+
: § $
+
: $
+
@ $1, @ $2: $3
<route-addr>
canonical R§ $
*
$@ @ $1...and exit
# UUCP must always be presented in old form R$+ @ $-. UUCP $2!$1 u@h.UUCP › h!u
# delete duplicate local names
R$
+
%
$
=
w @ $
=
w $1 @ $j u
%
host@host ›
u@host
#######################################################
### Ruleset 97 - recanonicalize and call ruleset
### zero (used for recursive calls)
#######################################################
S97
R$
*
$: $
>
3 $1
R$
*
$@ $
>
0 $1