xref: /plan9/mail/lib/rewrite.gateway (revision e06f534bbaa4097bc6f4764ef1dd2dc3338fbd40)
1#
2#	sample rewrite file for systems that send mail to a mail server or gateway
3#	for delivery.  we assume the mail server handles incoming messages.
4#
5#	by default the return address points to this system; set $site
6#	to the name of the mail server that receives your mail in
7#	/rc/bin/termrc and /rc/bin/cpurc.
8#
9#	replace YOURDOMAIN.DOM with the name of your domain.
10#
11#	in the last rule, $smtp is the name of the mail server.  set it
12#	in the DNS database in /lib/ndb (see ndb(6)).
13
14# translate local aliases from /mail/lib/namefiles
15\"(.+)\"		translate	"/bin/upas/aliasmail '\1'"
16[^!@.]+			translate	"/bin/upas/aliasmail '&'"
17
18# append the local domain to addresses without a domain
19local!"(.+)"		alias		\1@YOURDOMAIN.DOM
20local!(.*)		alias		\1@YOURDOMAIN.DOM
21
22# convert source domain address to a chain a@b@c@d...
23@([^@!,]*):([^!@]*)@([^!]*)		alias	\2@\3@\1
24@([^@!]*),@([^!@,]*):([^!@]*)@([^!]*)	alias	@\1:\3@\4@\2
25
26# convert a chain a@b@c@d... to ...d!c!b!a
27([^@]+)@([^@]+)@(.+)	alias		\2!\1@\3
28([^@]+)@([^@]+)		alias		\2!\1
29
30# send all mail to the gateway or mail server, $smtp,  for delivery
31([^!]*)!(.*) 		| 		"/mail/lib/qmail '\s' 'net!$smtp'" "'\2@\1'"
32