aboutsummaryrefslogtreecommitdiff
path: root/mail/lib/rewrite
blob: 837d28a28697d3f82cf2850fca3a4eec2cd37f6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#
#	sample rewrite file for systems that send mail to a mail server or gateway
#	for delivery.  we assume the mail server handles incoming messages.
#
#	by default the return address points to this system; set $site
#	to the name of the mail server that receives your mail.
#
#	replace YOURDOMAIN.DOM with the name of your domain.
#
#	in the last rule, $smtp is the name of the mail server.  set it
#	in the DNS database in $PLAN9/lib/ndb (see ndb(7)).

# translate local aliases from /mail/lib/namefiles
[^!@.]+			translate	"$PLAN9/bin/upas/aliasmail '&'"

# append the local domain to addresses without a domain
local!(.*)		alias		\1@swtch.com

# convert source domain address to a chain a@b@c@d...
@([^@!,]*):([^!@]*)@([^!]*)		alias	\2@\3@\1
@([^@!]*),@([^!@,]*):([^!@]*)@([^!]*)	alias	@\1:\3@\4@\2

# convert a chain a@b@c@d... to ...d!c!b!a
([^@]+)@([^@]+)@(.+)	alias		\2!\1@\3
([^@]+)@([^@]+)		alias		\2!\1

# send swtch.com mail separately to appease mail avenger
(swtch.com)!(.*)	|	"$PLAN9/mail/lib/qmail '\s' 'swtch.com'" "'\2@\1'"

# send all mail to the gateway or mail server, $smtp,  for delivery
([^!]*)!(.*) 		| 		"$PLAN9/mail/lib/qmail '\s' 'holo.morphisms.net'" "'\2@\1'"