~fultonbrowne/rc-scripts

75ca8aa4130105bb6d844526886b21cae0bc9f7b — glenda 1 year, 1 day ago 0af5cda
added mail things
4 files changed, 50 insertions(+), 12 deletions(-)

A lib/remotemail
A lib/rewrite
A util/add-emailkey
M util/factotumgr
A lib/remotemail => lib/remotemail +16 -0
@@ 0,0 1,16 @@
#!/bin/rc
shift
sender=fulton@fulton.software
shift
addr=tcp!fulton.software!587
shift
echo here
fd=‘{/bin/upas/aliasmail -f $sender}
switch($fd){
case *.*
	;
case *
	fd=fulton.software
}
echo $*
exec /bin/upas/smtp -u fulton@fulton.software -a -h $fd $addr $sender $*

A lib/rewrite => lib/rewrite +31 -0
@@ 0,0 1,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 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@fulton.software
local!(.*)		alias		\1@fulton.software

# 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'"

A util/add-emailkey => util/add-emailkey +2 -0
@@ 0,0 1,2 @@
#!/bin/rc
echo 'key proto=pass server=fulton.software service=smtp user=fulton@fulton.software !password=$1' > /mnt/factotum/ctl

M util/factotumgr => util/factotumgr +1 -12
@@ 1,18 1,7 @@
#! /bin/rc
# Add a smpt password with:
# factotumgr -s server user password 
while (~ $1 -*){
	switch($1){
	case -s
		smpt = yes
		shift
	case -*
		echo bad flag $1 >>[1=2]
		shift
	}
}
if(~ smpt){
	echo 'key proto=pass server=$1 service=smpt \
	user=$2 !password=$3'\
	>/mnt/factotum/ctl
}