Настройка программы sendmail
############################
### Ruleset 0 Parse Address
############################
SO
R
<@>
$#local $:
<>
special case error msgs R$
*
: $
*
; $#error $@ USAGE $: list:;
syntax illegal for recipient addresses
USAGE $: user address
USAGE $: colon illegal
[ $2 ]
>
$1
<
$>
97 $2 @here:...
>
$@ $
>
97 $1 $2 $3
R
<@ $+>
$#error $@
required
R
<$*: $* >
$
"error in host name part"
# handle numeric address spec
R$
*
< @ [$+]>
$
*
$: $
>
98 $1
$3
-
numeric internet spec
R$
*
< @ [$+]>
$
*
$#smtp $@ [$2] $:
[$2]
>
$3 still numeric: send
# now delete the local info - note $=0 to find characters that cause forwarding
R$
*
< @ >
$
*
$@ $
>
97 $1 user@ › user R
< @ $=w. >
: $
*
R$
*
$
=
0 $
*
< @ $=w...@here >
...
# handle local hacks R$* $: $>98 $1
# short circuit local delivery so forwarded email works
R$
+
< @ $=w. >
$: $1
< @ $2. @ $H >
first try hub
R$
+
< $+ @ $+ >
$#local $: $1 yep....
R$
+
< $+ @ >
$#local $: @ $1 nope, local address
# resolve remotely connected UUCP links (if any)
# resolve fake top level domains by forwarding to other hosts
R$
*
<@$+.BITNET.>
$
*
$: $
>
95
< $8 >
$1
<@$2.BITNET.>
$3 user@host.BITNET
# forward non-local UUCP traffic to our UUCP relay R$*<@$*.UUCP.>$* $: $>95 < $Y > $1
<@$2.UUCP.>
$3 uucp mail
# pass names that still have a host to a smarthost (if defined)
R$
*
<§$*>
$
*
$: $
>
95
< $S >
$1
< @ $2 >
$3 glue on smarthost name
# deal with other remote names
R$
*
< @$* >
$
*
$#smtp $@ $2 $: $1
< e $2 >
$3 user@host .domain
# if this is quoted, strip the quotes and try again
R$
+
$: $(dequote $1 $) strip quotes R$
+
$
=
0 $
+
$@ $
>
97 $1 $2 $3 try again
# handle locally delivered names
R$
=
L $#local $: @ $1 special local names R$
+
$#local $: $1 regular local names
##################################################
### Ruleset 5 special rewriting after aliases
### have been expanded (new sendmail only)
##################################################
S5
# see if we have a relay or a hub
R$
+
$:
< $R >
$1 try relay
R
< >
$
+
$:
< $H >
$1 try hub
R
< >
$
+
$@ $1 nope, give up
R
< $-:$+>
$
+
$: $
>
95
< $1: $2 >
$3
< @
$2 >
R
< $+ >
$
+
$@ $
>
95
< $1 >
$2
< @ $1 >
#######################################################
### Ruleset 95 canonify mailer: host syntax to
### triple
####################################################### S95
R
< >
$
*
$@ $1 strip off null relay
R
< $-:$+>
$
*
$# $1 $@ $2 $: $3 try quali
-
fied mailer
R
< $=w >
$
*
$@ $2 delete local host
R
< $+ >
$
*
$#relay $@ $1 $: $2 use unqualified
mailer
##########################################
### Ruleset 98 local part of ruleset zero
### (can be null)
###########################################
S98
За секцией преобразования адресов следует секция определения программ рассылки почты. В ней определяется локальная программа рассылки (mail), программа рассылки для выполнения (sh) и программа рассылки по SMTP.
##########################################
### Local and Program Mailer specification
##########################################
Mlocal, P
=
/
usr
/
libexec
/
mail .local, F
=
lsDFMrmn, S
=
10, R
=
20
/
40,
A
=
mail
-
d $u Mprog, P
=
/
bin
/
sh, F
=
lsDFMeu, S
=
10, R
=
20
/
40, D
=
$z:
/
,
A
=
sh
-
c $u S10
R
<@>
$n errors to mailer
-
daemon R$
+
$: $
>
40 $1 S20
R$
+
< § $* >
$: $1 strip host part S40
################################
### SMTP Mailer specification
################################
Msmtp, P
=
[IPC], F
=
mDFMuX, 8
=
11
/
31, R
=
21, E
=
\r\n, L
=
990, A
=
IPC $h
Mesmtp, P
=
[IPC], F
=
mDFMuXa, 8
=
11
/
31, R
=
21, E
=
\r\n, L
=
990, A
=
IPC $h
Mrelay, P
=
[IPC], F
=
mDFMuXa, 8
=
11
/
31, R
=
61, E
=
\r\n, L
=
2040, A
=
IPC $h
Затем идут правила определения локального преобразования адресов для конкретных программ рассылки, в частности набор правил S11.
### envelope sender and masquerading recipient
### rewriting
811
R$
+
$: $
>
51 $1 sender
/
recipient common
R$
*
:;
<@>
$@ $1:; list:; special case
R$
*
$@ $
>
61 $1 qualify unqualed names
В секции программ рассылки мы в нашем примере не указали еще одну важную возможность – рассылку по протоколу UUCP:
Muucp, P
=
/
usr
/
bin
/
uux, F
=
DFMhuU, B
=
13, R
=
23,
M
=
100000,
A
=
uux
-
r
-
z
-
a$f
-
gC $h! rmail
Естественно, что правила преобразования адресов S13 и R23 должны быть описаны в файле настроек send-mail.