Plan 9 from Bell Labs’s /usr/web/sources/plan9/mail/lib/rewrite.gateway

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#
#	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 in 
#	/rc/bin/termrc and /rc/bin/cpurc.
#
#	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 /lib/ndb (see ndb(6)).

# translate local aliases from /mail/lib/namefiles
\"(.+)\"		translate	"/bin/upas/aliasmail '\1'"
[^!@.]+			translate	"/bin/upas/aliasmail '&'"

# append the local domain to addresses without a domain
local!"(.+)"		alias		\1@YOURDOMAIN.DOM
local!(.*)		alias		\1@YOURDOMAIN.DOM

# 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 all mail to the gateway or mail server, $smtp,  for delivery
([^!]*)!(.*) 		| 		"/mail/lib/qmail '\s' 'net!$smtp'" "'\2@\1'"

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.