Commit | Line | Data |
---|---|---|
f25ecb3d EA |
1 | divert(-1) |
2 | # | |
3 | # Copyright (c) 1983 Eric P. Allman | |
4 | # Copyright (c) 1988 The Regents of the University of California. | |
5 | # All rights reserved. | |
6 | # | |
7 | # %sccs.include.redist.sh% | |
8 | # | |
9 | divert(0) | |
10 | ||
576bbd75 | 11 | VERSIONID(`@(#)proto.m4 6.42 (Berkeley) %G%') |
f25ecb3d | 12 | |
6f403f33 | 13 | MAILER(local)dnl |
f25ecb3d | 14 | |
576bbd75 EA |
15 | ifdef(`_OLD_SENDMAIL_', |
16 | `define(`_SET_96_', 6)dnl | |
17 | define(`_SET_97_', 7)dnl', | |
e46fc989 | 18 | `# level 4 config file format |
576bbd75 EA |
19 | V4 |
20 | define(`_SET_96_', 96)dnl | |
21 | define(`_SET_97_', 97)dnl') | |
242270da | 22 | |
f25ecb3d EA |
23 | ################## |
24 | # local info # | |
25 | ################## | |
26 | ||
7df175c3 EA |
27 | CP. |
28 | ||
dacf3c9f | 29 | Cwlocalhost |
5461a68b | 30 | ifdef(`USE_CW_FILE', |
dacf3c9f | 31 | `# file containing names of hosts for which we receive email |
a719f50c | 32 | CONCAT(`Fw', confCW_FILE)', `dnl') |
f25ecb3d EA |
33 | |
34 | ifdef(`UUCP_RELAY', | |
35 | `# UUCP relay host | |
8038f5d5 | 36 | CONCAT(DY, UUCP_RELAY) |
7df175c3 | 37 | CPUUCP |
a151c868 | 38 | |
f25ecb3d EA |
39 | ')dnl |
40 | ifdef(`BITNET_RELAY', | |
41 | `# BITNET relay host | |
42 | CONCAT(DB, BITNET_RELAY) | |
7df175c3 | 43 | CPBITNET |
a151c868 | 44 | |
f25ecb3d EA |
45 | ')dnl |
46 | ifdef(`CSNET_RELAY', | |
47 | `# CSNET relay host | |
48 | CONCAT(DC, CSNET_RELAY) | |
7df175c3 | 49 | CPCSNET |
a151c868 | 50 | |
d2e7dfa9 EA |
51 | ')dnl |
52 | ifdef(`FAX_RELAY', | |
53 | `# FAX relay host | |
54 | CONCAT(DF, FAX_RELAY) | |
7df175c3 | 55 | CPFAX |
d2e7dfa9 | 56 | |
f25ecb3d | 57 | ')dnl |
97dcbde7 EA |
58 | ifdef(`SMART_HOST', |
59 | `# "Smart" UUCP relay host | |
60 | CONCAT(DS, SMART_HOST) | |
f25ecb3d | 61 | |
8d95d628 EA |
62 | ')dnl |
63 | ifdef(`MAILER_TABLE', | |
64 | `# Mailer table (overriding domains) | |
65 | Kmailertable MAILER_TABLE | |
66 | ||
97dcbde7 | 67 | ')dnl |
f25ecb3d EA |
68 | # who I send unqualified names to (null means deliver locally) |
69 | CONCAT(DR, ifdef(`LOCAL_RELAY', LOCAL_RELAY)) | |
70 | ||
22bc0471 EA |
71 | # who gets all local email traffic ($R has precedence for unqualified names) |
72 | CONCAT(DH, ifdef(`MAIL_HUB', MAIL_HUB)) | |
73 | ||
97dcbde7 EA |
74 | # my official hostname ($w or $w.$D) |
75 | CONCAT(Dj$w, ifdef(`NEED_DOMAIN', .$D)) | |
76 | ||
77 | # who I masquerade as (can be $j) | |
78 | CONCAT(DM, ifdef(`MASQUERADE_NAME', MASQUERADE_NAME, $j)) | |
79 | ||
45eb1b8f EA |
80 | # class L: names that should be delivered locally, even if we have a relay |
81 | # class E: names that should be exposed as from this host, even if we masquerade | |
3eb5f759 | 82 | CLroot |
45eb1b8f | 83 | CEroot |
3eb5f759 EA |
84 | undivert(5)dnl |
85 | ||
f25ecb3d | 86 | # operators that cannot be in local usernames (i.e., network indicators) |
1429c39b | 87 | CO @ % ifdef(`_NO_UUCP_', `', `!') |
f25ecb3d | 88 | |
6f403f33 EA |
89 | # a class with just dot (for identifying canonical names) |
90 | C.. | |
91 | ||
32014295 EA |
92 | ifdef(`_OLD_SENDMAIL_', `dnl', |
93 | `# dequoting map | |
94 | Kdequote dequote') | |
f25ecb3d | 95 | |
9863b6e1 EA |
96 | undivert(6)dnl |
97 | ||
a151c868 EA |
98 | ###################### |
99 | # Special macros # | |
100 | ###################### | |
101 | ||
102 | # SMTP initial login message | |
103 | CONCAT(De, confSMTP_LOGIN_MSG) | |
104 | ||
105 | # UNIX initial From header format | |
106 | CONCAT(Dl, confFROM_LINE) | |
107 | ||
108 | # my name for error messages | |
109 | CONCAT(Dn, confMAILER_NAME) | |
110 | ||
111 | # delimiter (operator) characters | |
112 | CONCAT(Do, confOPERATORS) | |
f25ecb3d | 113 | |
a151c868 EA |
114 | # format of a total name |
115 | CONCAT(Dq, ifdef(`confFROM_HEADER', confFROM_HEADER, | |
116 | ifdef(`_OLD_SENDMAIL_', `$g$?x ($x)$.', `$?x$x <$g>$|$g$.'))) | |
f25ecb3d | 117 | include(`../m4/version.m4') |
a151c868 EA |
118 | |
119 | ############### | |
120 | # Options # | |
121 | ############### | |
122 | ||
0b8c3ec1 EA |
123 | # strip message body to 7 bits on input? |
124 | CONCAT(O7, confSEVEN_BIT_INPUT) | |
a151c868 EA |
125 | |
126 | # wait (in minutes) for alias file rebuild | |
127 | CONCAT(Oa, confALIAS_WAIT) | |
128 | ||
129 | # location of alias file | |
130 | CONCAT(OA, ifdef(`ALIAS_FILE', ALIAS_FILE, /etc/aliases)) | |
131 | ||
63381843 EA |
132 | # minimum number of free blocks on filesystem |
133 | CONCAT(Ob, confMIN_FREE_BLOCKS) | |
134 | ||
a151c868 EA |
135 | # substitution for space (blank) characters |
136 | CONCAT(OB, confBLANK_SUB) | |
137 | ||
138 | # connect to "expensive" mailers on initial submission? | |
139 | CONCAT(Oc, confCON_EXPENSIVE) | |
140 | ||
141 | # checkpoint queue runs after every N successful deliveries | |
142 | CONCAT(OC, confCHECKPOINT_INTERVAL) | |
143 | ||
144 | # default delivery mode | |
145 | CONCAT(Od, confDELIVERY_MODE) | |
146 | ||
147 | # automatically rebuild the alias database? | |
148 | CONCAT(OD, confAUTO_REBUILD) | |
149 | ||
150 | # error message header/file */ | |
151 | ifdef(`confERROR_MESSAGE', | |
152 | concat(OE, confERROR_MESSAGE), | |
153 | #OE/etc/sendmail.oE) | |
154 | ||
155 | # error mode | |
156 | ifdef(`confERROR_MODE', | |
157 | concat(Oe, confERROR_MODE), | |
158 | #Oep) | |
159 | ||
160 | # save Unix-style "From_" lines at top of header? | |
161 | CONCAT(Of, confSAVE_FROM_LINES) | |
162 | ||
163 | # temporary file mode | |
164 | CONCAT(OF, confTEMP_FILE_MODE) | |
165 | ||
166 | # match recipients against GECOS field? | |
167 | CONCAT(OG, confMATCH_GECOS) | |
168 | ||
169 | # default GID | |
170 | CONCAT(Og, confDEF_GROUP_ID) | |
171 | ||
172 | # maximum hop count | |
173 | CONCAT(Oh, confMAX_HOP) | |
174 | ||
175 | # location of help file | |
176 | CONCAT(OH, ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf)) | |
177 | ||
178 | # ignore dots as terminators in incoming messages? | |
179 | CONCAT(Oi, confIGNORE_DOTS) | |
180 | ||
181 | # Insist that the BIND name server be running to resolve names | |
182 | ifdef(`confBIND_OPTS', | |
183 | CONCAT(OI, confBIND_OPTS), | |
184 | #OI) | |
185 | ||
0b8c3ec1 EA |
186 | # deliver MIME-encapsulated error messages? |
187 | CONCAT(Oj, confMIME_FORMAT_ERRORS) | |
188 | ||
a151c868 EA |
189 | # Forward file search path |
190 | ifdef(`confFORWARD_PATH', | |
191 | CONCAT(OJ, confFORWARD_PATH), | |
192 | #OJ/var/forward/$u:$z/.forward.$w:$z/.forward) | |
193 | ||
194 | # open connection cache size | |
195 | CONCAT(Ok, confMCI_CACHE_SIZE) | |
196 | ||
197 | # open connection cache timeout | |
198 | CONCAT(OK, confMCI_CACHE_TIMEOUT) | |
199 | ||
200 | # log level | |
201 | CONCAT(OL, confLOG_LEVEL) | |
202 | ||
203 | # send to me too, even in an alias expansion? | |
204 | CONCAT(Om, confME_TOO) | |
205 | ||
206 | # verify RHS in newaliases? | |
207 | CONCAT(On, confCHECK_ALIASES) | |
208 | ||
209 | # default messages to old style headers if no special punctuation? | |
210 | CONCAT(Oo, confOLD_STYLE_HEADERS) | |
211 | ||
4c230f32 EA |
212 | # SMTP daemon options |
213 | ifdef(`confDAEMON_OPTIONS', | |
214 | CONCAT(OO, confDAEMON_OPTIONS), | |
215 | #OOPort=esmtp) | |
216 | ||
63381843 EA |
217 | # privacy flags |
218 | CONCAT(Op, confPRIVACY_FLAGS) | |
219 | ||
a151c868 EA |
220 | # who (if anyone) should get extra copies of error messages |
221 | ifdef(`confCOPY_ERRORS_TO', | |
222 | CONCAT(OP, confCOPY_ERRORS_TO), | |
223 | #OPPostmaster) | |
224 | ||
225 | # slope of queue-only function | |
226 | ifdef(`confQUEUE_FACTOR', | |
227 | CONCAT(Oq, confQUEUE_FACTOR), | |
228 | #Oq600000) | |
229 | ||
230 | # queue directory | |
231 | CONCAT(OQ, ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue)) | |
232 | ||
233 | # read timeout -- now OK per RFC 1123 section 5.3.2 | |
e46fc989 EA |
234 | ifdef(`confREAD_TIMEOUT', |
235 | CONCAT(Or, confREAD_TIMEOUT), | |
236 | #Ordatablock=10m) | |
a151c868 EA |
237 | |
238 | # queue up everything before forking? | |
239 | CONCAT(Os, confSAFE_QUEUE) | |
240 | ||
241 | # status file | |
242 | CONCAT(OS, ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st)) | |
243 | ||
244 | # default message timeout interval | |
245 | CONCAT(OT, confMESSAGE_TIMEOUT) | |
246 | ||
247 | # time zone handling: | |
248 | # if undefined, use system default | |
249 | # if defined but null, use TZ envariable passed in | |
250 | # if defined and non-null, use that info | |
251 | ifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot', | |
252 | confTIME_ZONE, `USE_TZ', `', | |
253 | `CONCAT(Ot, confTIME_ZONE)') | |
254 | ||
255 | # default UID | |
256 | CONCAT(Ou, confDEF_USER_ID) | |
257 | ||
258 | # list of locations of user database file (null means no lookup) | |
bd00122c | 259 | OU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC') |
a151c868 | 260 | |
4c230f32 EA |
261 | # fallback MX host |
262 | ifdef(`confFALLBACK_MX', | |
263 | CONCAT(OV, confFALLBACK_MX), | |
264 | #OVfall.back.host.net) | |
265 | ||
a151c868 EA |
266 | # load average at which we just queue messages |
267 | CONCAT(Ox, confQUEUE_LA) | |
268 | ||
269 | # load average at which we refuse connections | |
270 | CONCAT(OX, confREFUSE_LA) | |
271 | ||
272 | # work recipient factor | |
273 | ifdef(`confWORK_RECIPIENT_FACTOR', | |
274 | CONCAT(Oy, confWORK_RECIPIENT_FACTOR), | |
275 | #Oy30000) | |
276 | ||
277 | # deliver each queued job in a separate process? | |
278 | CONCAT(OY, confSEPARATE_PROC) | |
279 | ||
280 | # work class factor | |
281 | ifdef(`confWORK_CLASS_FACTOR', | |
282 | CONCAT(Oz, confWORK_CLASS_FACTOR), | |
283 | #Oz1800) | |
284 | ||
285 | # work time factor | |
286 | ifdef(`confWORK_TIME_FACTOR', | |
287 | CONCAT(OZ, confWORK_TIME_FACTOR), | |
288 | #OZ90000) | |
289 | ||
290 | ########################### | |
291 | # Message precedences # | |
292 | ########################### | |
293 | ||
294 | Pfirst-class=0 | |
295 | Pspecial-delivery=100 | |
97dcbde7 | 296 | Plist=-30 |
a151c868 EA |
297 | Pbulk=-60 |
298 | Pjunk=-100 | |
299 | ||
300 | ##################### | |
301 | # Trusted users # | |
302 | ##################### | |
303 | ||
304 | Troot | |
305 | Tdaemon | |
306 | Tuucp | |
307 | ||
308 | ######################### | |
309 | # Format of headers # | |
310 | ######################### | |
311 | ||
e0a38185 | 312 | H?P?Return-Path: $g |
576bbd75 | 313 | HReceived: $?sfrom $s $.$?_($_) $.by $j ($v/$Z)$?r with $r$. id $i; $b |
a151c868 EA |
314 | H?D?Resent-Date: $a |
315 | H?D?Date: $a | |
316 | H?F?Resent-From: $q | |
317 | H?F?From: $q | |
318 | H?x?Full-Name: $x | |
319 | HSubject: | |
320 | # HPosted-Date: $a | |
321 | # H?l?Received-Date: $b | |
322 | H?M?Resent-Message-Id: <$t.$i@$j> | |
323 | H?M?Message-Id: <$t.$i@$j> | |
f25ecb3d EA |
324 | #\f |
325 | ###################################################################### | |
326 | ###################################################################### | |
327 | ##### | |
328 | ##### REWRITING RULES | |
329 | ##### | |
330 | ###################################################################### | |
331 | ###################################################################### | |
332 | ||
da9b1c77 | 333 | undivert(9)dnl |
f25ecb3d EA |
334 | |
335 | ########################################### | |
336 | ### Rulset 3 -- Name Canonicalization ### | |
337 | ########################################### | |
755e2424 | 338 | S3 |
f25ecb3d | 339 | |
66fe2d65 EA |
340 | # handle null input and list syntax (translate to <@> special case) |
341 | R$@ $@ <@> | |
23ae62a0 | 342 | R$*:;$* $@ $1 :; <@> |
77e96a45 | 343 | |
f25ecb3d | 344 | # basic textual canonicalization -- note RFC733 heuristic here |
ce25e438 | 345 | R$*<$*>$*<$*>$* <$2>$3$4$5 strip multiple <> <> |
4850f6e1 | 346 | R$*<$*<$+>$*>$* <$3>$5 2-level <> nesting |
66fe2d65 | 347 | R$*<>$* $@ <@> MAIL FROM:<> case |
f25ecb3d EA |
348 | R$*<$+>$* $2 basic RFC821/822 parsing |
349 | ||
350 | # make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later | |
56ec6f89 | 351 | R@ $+ , $+ @ $1 : $2 change all "," to ":" |
f25ecb3d EA |
352 | |
353 | # localize and dispose of route-based addresses | |
576bbd75 | 354 | R@ $+ : $+ $@ $>_SET_96_ < @$1 > : $2 handle <route-addr> |
f25ecb3d EA |
355 | |
356 | # find focus for list syntax | |
576bbd75 | 357 | R $+ : $* ; @ $+ $@ $>_SET_96_ $1 : $2 ; < @ $3 > list syntax |
56ec6f89 | 358 | R $+ : $* ; $@ $1 : $2; list syntax |
f25ecb3d EA |
359 | |
360 | # find focus for @ syntax addresses | |
56ec6f89 EA |
361 | R$+ @ $+ $: $1 < @ $2 > focus on domain |
362 | R$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right | |
576bbd75 | 363 | R$+ < @ $+ > $@ $>_SET_96_ $1 < @ $2 > already canonical |
f25ecb3d | 364 | |
1429c39b EA |
365 | ifdef(`_NO_UUCP_', `dnl', |
366 | `# convert old-style addresses to a domain-based address | |
576bbd75 EA |
367 | R$- ! $+ $@ $>_SET_96_ $2 < @ $1 .UUCP > resolve uucp names |
368 | R$+ . $- ! $+ $@ $>_SET_96_ $3 < @ $1 . $2 > domain uucps | |
369 | R$+ ! $+ $@ $>_SET_96_ $2 < @ $1 .UUCP > uucp subdomains') | |
f25ecb3d EA |
370 | |
371 | # if we have % signs, take the rightmost one | |
56ec6f89 EA |
372 | R$* % $* $1 @ $2 First make them all @s. |
373 | R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. | |
576bbd75 | 374 | R$* @ $* $@ $>_SET_96_ $1 < @ $2 > Insert < > and finish |
f25ecb3d EA |
375 | |
376 | # else we must be a local name | |
377 | ||
378 | ||
576bbd75 EA |
379 | ################################################ |
380 | ### Ruleset _SET_96_ -- bottom half of ruleset 3 ### | |
381 | ################################################ | |
f25ecb3d | 382 | |
45eb1b8f | 383 | # At this point, everything should be in a "local_part<@domain>extra" format. |
576bbd75 | 384 | S`'_SET_96_ |
f25ecb3d EA |
385 | |
386 | # handle special cases for local names | |
89906048 EA |
387 | R$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all |
388 | R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain | |
389 | ifdef(`_NO_UUCP_', `dnl', | |
390 | `R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain') | |
dacf3c9f | 391 | undivert(2)dnl |
80961747 | 392 | |
f5ade8ff EA |
393 | ifdef(`_NO_UUCP_', `dnl', |
394 | `ifdef(`UUCP_RELAY', | |
1ab66980 | 395 | `# pass UUCP addresses straight through |
56ec6f89 | 396 | R$* < @ $+ . UUCP > $* $@ $1 < @ $2 . UUCP > $3', |
1ab66980 | 397 | `# if really UUCP, handle it immediately |
6f403f33 | 398 | ifdef(`_CLASS_U_', |
56ec6f89 | 399 | `R$* < @ $=U . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') |
6f403f33 | 400 | ifdef(`_CLASS_V_', |
56ec6f89 | 401 | `R$* < @ $=V . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') |
6f403f33 | 402 | ifdef(`_CLASS_W_', |
56ec6f89 | 403 | `R$* < @ $=W . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') |
6f403f33 | 404 | ifdef(`_CLASS_X_', |
56ec6f89 | 405 | `R$* < @ $=X . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') |
6f403f33 | 406 | ifdef(`_CLASS_Y_', |
56ec6f89 | 407 | `R$* < @ $=Y . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') |
80961747 EA |
408 | |
409 | # try UUCP traffic as a local address | |
56ec6f89 | 410 | R$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP > $3 |
82960e03 | 411 | ifdef(`_OLD_SENDMAIL_', |
56ec6f89 EA |
412 | `R$* < @ $+ . $+ . UUCP > $* $@ $1 < @ $2 . $3 . > $4', |
413 | `R$* < @ $+ . . UUCP > $* $@ $1 < @ $2 . > $3')') | |
f5ade8ff EA |
414 | ') |
415 | ifdef(`_NO_CANONIFY_', `dnl', | |
416 | `# pass to name server to make hostname canonical | |
7df175c3 | 417 | R$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4 |
f5ade8ff | 418 | ') |
dacf3c9f EA |
419 | undivert(8)dnl |
420 | ||
6f403f33 EA |
421 | # if this is the local hostname, make sure we treat is as canonical |
422 | R$* < @ $j > $* $: $1 < @ $j . > $2 | |
f25ecb3d | 423 | |
f25ecb3d EA |
424 | |
425 | ################################################## | |
426 | ### Ruleset 4 -- Final Output Post-rewriting ### | |
427 | ################################################## | |
428 | S4 | |
429 | ||
66fe2d65 | 430 | R$*<@> $@ $1 handle <> and list:; |
f25ecb3d EA |
431 | |
432 | # resolve numeric addresses to name if possible | |
6f403f33 EA |
433 | R$* < @ [ $+ ] > $* $: $1 < @ $[ [$2] $] > $3 lookup numeric internet addr |
434 | ||
435 | # strip trailing dot off possibly canonical name | |
436 | R$* < @ $+ . > $* $1 < @ $2 > $3 | |
f25ecb3d EA |
437 | |
438 | # externalize local domain info | |
6f403f33 EA |
439 | R$* < $+ > $* $1 $2 $3 defocus |
440 | R@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical | |
9d6b5c00 | 441 | R@ $* $@ @ $1 ... and exit |
f25ecb3d | 442 | |
1429c39b EA |
443 | ifdef(`_NO_UUCP_', `dnl', |
444 | `# UUCP must always be presented in old form | |
445 | R$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u') | |
f25ecb3d EA |
446 | |
447 | # delete duplicate local names | |
6f403f33 | 448 | R$+ % $=w @ $=w $1 @ $j u%host@host => u@host |
f25ecb3d EA |
449 | |
450 | ||
451 | ||
576bbd75 EA |
452 | ############################################################## |
453 | ### Ruleset _SET_97_ -- recanonicalize and call ruleset zero ### | |
454 | ### (used for recursive calls) ### | |
455 | ############################################################## | |
f25ecb3d | 456 | |
576bbd75 | 457 | S`'_SET_97_ |
f25ecb3d EA |
458 | R$* $: $>3 $1 |
459 | R$* $@ $>0 $1 | |
460 | ||
461 | ||
462 | ###################################### | |
463 | ### Ruleset 0 -- Parse Address ### | |
464 | ###################################### | |
465 | ||
466 | S0 | |
467 | ||
00948e88 | 468 | R<@> $#local $: <> special case error msgs |
0b8c3ec1 | 469 | R$*:;<@> $#error $@ USAGE $: "list:; syntax illegal for recipient addresses" |
89d51ef0 | 470 | |
56ec6f89 EA |
471 | ifdef(`_MAILER_smtp_', |
472 | `# handle numeric address spec | |
6f403f33 | 473 | R$* < @ [ $+ ] > $* $: $1 < @ $[ [$2] $] > $3 numeric internet addr |
56ec6f89 | 474 | R$* < @ [ $+ ] > $* $#smtp $@ [$2] $: $1 @ [$2] $3 numeric internet spec', |
6f92b9b3 | 475 | `dnl') |
f25ecb3d | 476 | |
5461a68b | 477 | # now delete the local info -- note $=O to find characters that cause forwarding |
576bbd75 EA |
478 | R$* < @ > $* $@ $>_SET_97_ $1 user@ => user |
479 | R< @ $=w . > : $* $@ $>_SET_97_ $2 @here:... -> ... | |
480 | R$* $=O $* < @ $=w . > $@ $>_SET_97_ $1 $2 $3 ...@here -> ... | |
8d95d628 EA |
481 | ifdef(`MAILER_TABLE', |
482 | ` | |
483 | # try mailer table lookup | |
7d426e19 | 484 | R$* < @ $-:$+ > $* $# $2 $@ $3 $: $1 @ $3 $4 found a match', |
8d95d628 | 485 | `dnl') |
f25ecb3d EA |
486 | |
487 | # short circuit local delivery so forwarded email works | |
2664707d | 488 | ifdef(`_LOCAL_NOT_STICKY_', |
576bbd75 EA |
489 | `R$=L < @ $=w . > $#local $: @ $1 special local names |
490 | R$+ < @ $=w . > $#local $: $1 dispose directly', | |
491 | `R$+ < @ $=w . > $: $1 < @ $2 @ $H > first try hub | |
82960e03 | 492 | ifdef(`_OLD_SENDMAIL_', |
7d426e19 EA |
493 | `R$+ < $+ @ $-:$+ > $# $3 $@ $4 $: $1 $2 yep .... |
494 | R$+ < $+ @ $+ > $#relay $@ $3 $: $1 $2 yep .... | |
22bc0471 EA |
495 | R$+ < $+ @ > $#local $: $1 nope, local address', |
496 | `R$+ < $+ @ $+ > $#local $: $1 yep .... | |
2664707d | 497 | R$+ < $+ @ > $#local $: @ $1 nope, local address')') |
f25ecb3d | 498 | undivert(3)dnl |
755e2424 EA |
499 | undivert(4)dnl |
500 | ||
56ec6f89 | 501 | # resolve remotely connected UUCP links (if any) |
708a514b | 502 | ifdef(`_CLASS_V_', |
7d426e19 | 503 | `R$* < @ $=V . UUCP > $* $#smtp $@ $V $: @ $V : $1 @ $2.UUCP $3', |
47523c33 | 504 | `dnl') |
708a514b | 505 | ifdef(`_CLASS_W_', |
7d426e19 | 506 | `R$* < @ $=W . UUCP > $* $#smtp $@ $W $: @ $W : $1 @ $2.UUCP $3', |
47523c33 | 507 | `dnl') |
708a514b | 508 | ifdef(`_CLASS_X_', |
7d426e19 | 509 | `R$* < @ $=X . UUCP > $* $#smtp $@ $X $: @ $X : $1 @ $2.UUCP $3', |
47523c33 | 510 | `dnl') |
755e2424 | 511 | |
f25ecb3d EA |
512 | # resolve fake top level domains by forwarding to other hosts |
513 | ifdef(`BITNET_RELAY', | |
7d426e19 | 514 | `R$*<@$+.BITNET>$* $#smtp $@ $B $: $1 @ $2 . BITNET $3 user@host.BITNET', |
f25ecb3d EA |
515 | `dnl') |
516 | ifdef(`CSNET_RELAY', | |
7d426e19 | 517 | `R$*<@$+.CSNET>$* $#smtp $@ $C $: $1 @ $2 . CSNET $3 user@host.CSNET', |
f25ecb3d | 518 | `dnl') |
d2e7dfa9 EA |
519 | ifdef(`_MAILER_fax_', |
520 | `R$+ < @ $+ .FAX > $#fax $@ $2 $: $1 user@host.FAX', | |
521 | `ifdef(`FAX_RELAY', | |
7d426e19 | 522 | `R$*<@$+.FAX>$* $#smtp $@ $F $: $1 @ $2 . FAX $3 user@host.FAX', |
d2e7dfa9 | 523 | `dnl')') |
f25ecb3d | 524 | |
755e2424 EA |
525 | ifdef(`UUCP_RELAY', |
526 | `# forward non-local UUCP traffic to our UUCP relay | |
7d426e19 | 527 | R$*<@$*.UUCP>$* $#smtp $@ $Y $: @ $Y : $1 @ $2.UUCP $3 uucp mail', |
56ec6f89 | 528 | `ifdef(`_MAILER_uucp_', |
755e2424 | 529 | `# forward other UUCP traffic straight to UUCP |
7d426e19 | 530 | R< @ $+ .UUCP > : $+ $#uucp $@ $1 $: $2 @host.UUCP:... |
6f403f33 | 531 | R$+ < @ $+ .UUCP > $#uucp $@ $2 $: $1 user@host.UUCP', |
755e2424 EA |
532 | `dnl')') |
533 | ||
97dcbde7 EA |
534 | ifdef(`_LOCAL_RULES_', |
535 | `# figure out what should stay in our local mail system | |
536 | undivert(1)', | |
537 | `ifdef(`_MAILER_smtp_', | |
56ec6f89 | 538 | `# deal with other remote names |
7d426e19 | 539 | R$* < @ $* > $* $#smtp $@ $2 $: $1 @ $2 $3 user@host.domain')') |
97dcbde7 EA |
540 | ifdef(`SMART_HOST', ` |
541 | # pass names that still have a host to a smarthost | |
542 | R$* < @ $* > $* $: < $S > $1 < @ $2 > $3 glue on smarthost name | |
7d426e19 EA |
543 | R<$-:$+> $* < @$* > $* $# $1 $@ $2 $: $3 @ $4 $5 if non-null, use it |
544 | R<$+> $* < @$* > $* $#suucp $@ $1 $: $2 @ $3 $4 if non-null, use it | |
97dcbde7 EA |
545 | R<> $* < @ $* > $* $1 < @ $2 > $3 else strip off gunk', |
546 | `ifdef(`_LOCAL_RULES_', ` | |
547 | # reject messages that have host names we do not understand | |
548 | R$* < @ $* > $* $#error $@ NOHOST $: Unrecognized host name $2', | |
549 | `dnl')') | |
63381843 EA |
550 | ifdef(`_MAILER_USENET_', ` |
551 | # addresses sent to net.group.USENET will get forwarded to a newsgroup | |
b7a43487 | 552 | R$+ . USENET $# usenet $: $1') |
f25ecb3d | 553 | |
82960e03 | 554 | ifdef(`_OLD_SENDMAIL_', |
5461a68b | 555 | `# forward remaining names to local relay, if any |
37e8750f EA |
556 | R$=L $#local $: $1 special local names |
557 | R$+ $: $1 < @ $R > append relay | |
22bc0471 EA |
558 | R$+ < @ > $: $1 < @ $H > no relay, try hub |
559 | R$+ < @ > $#local $: $1 no relay or hub: local | |
576bbd75 | 560 | R$+ < @ $=w > $#local $: $1 we are relay/hub: local |
97dcbde7 | 561 | R$+ < @ $-:$+ > $# $2 $@ $3 $: $1 deliver to relay/hub |
0d8911b2 | 562 | R$+ < @ $+ > $#relay $@ $2 $: $1 deliver to relay/hub', |
ccfcf4aa EA |
563 | |
564 | `# if this is quoted, strip the quotes and try again | |
565 | R$+ $: $(dequote $1 $) strip quotes | |
576bbd75 | 566 | R$* $=O $* $@ $>_SET_97_ $1 $2 $3 try again |
ccfcf4aa EA |
567 | |
568 | # handle locally delivered names | |
37e8750f EA |
569 | R$=L $#local $: @ $1 special local names |
570 | R$+ $#local $: $1 regular local names | |
6f403f33 | 571 | |
56ec6f89 EA |
572 | ########################################################################### |
573 | ### Ruleset 5 -- special rewriting after aliases have been expanded ### | |
574 | ### (new sendmail only) ### | |
575 | ########################################################################### | |
f25ecb3d | 576 | |
6f403f33 | 577 | S5 |
f25ecb3d | 578 | |
32014295 EA |
579 | # see if we have a relay or a hub |
580 | R$+ $: $1 < @ $R > | |
22bc0471 | 581 | R$+ < @ > $: $1 < @ $H > no relay, try hub |
576bbd75 | 582 | R$+ < @ $=w > $@ $1 we are relay/hub: local |
97dcbde7 | 583 | R$+ < @ $-:$+ > $# $2 $@ $3 $: $1 send to relay or hub |
32014295 EA |
584 | ifdef(`_MAILER_smtp_', |
585 | `R$+ < @ $+ > $#relay $@ $2 $: $1 send to relay or hub')') | |
bc09d8d3 EA |
586 | ifdef(`MAILER_TABLE', |
587 | ` | |
588 | ||
589 | ########################################################################### | |
590 | ### Ruleset 90 -- try domain part of mailertable entry ### | |
591 | ### (new sendmail only) ### | |
592 | ########################################################################### | |
593 | ||
594 | S90 | |
595 | R<$- . $+ > $* $: < $(mailertable .$2 $: $) > $3 lookup | |
596 | R<$- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved? | |
576bbd75 | 597 | R<$- . $+ > $* $@ $>90 <$2> $3 no -- strip & try again |
bc09d8d3 EA |
598 | R<$*> $* $@ $2 no match', |
599 | `dnl') | |
f25ecb3d EA |
600 | #\f |
601 | ###################################################################### | |
602 | ###################################################################### | |
603 | ##### | |
ec174858 | 604 | `##### MAILER DEFINITIONS' |
f25ecb3d EA |
605 | ##### |
606 | ###################################################################### | |
607 | ###################################################################### | |
f25ecb3d | 608 | undivert(7)dnl |