Blob


1 #!/bin/rc
3 # create a /tmp for here documents
4 rfork en
5 bind -c /mail/tmp /tmp
7 KEY=whocares
8 USER=ken
10 RECIP=$1
11 MBOX=$2
12 PF=/mail/box/$USER/_pattern
13 TMP=/mail/tmp/mine.$pid
14 BIN=/bin/upas
15 D=/mail/fs/mbox/1
17 # save and parse the mail file
18 {sed '/^$/,$ s/^From / From /'; echo} > $TMP
19 upas/fs -f $TMP
21 # if we like the source
22 # or if the subject contains a valid token
23 # then deliver the mail and allow all the addresses
24 if( $BIN/list check $PF $D/from $D/sender $D/replyto )
25 {
26 $BIN/deliver $RECIP $D/from $MBOX < $D/raw
27 $BIN/list add $PF $D/from $D/to $D/cc $D/sender
28 rm $TMP
29 exit 0
30 }
31 switch($status){
32 case *!match*
33 echo `{date} dropped $RECIP From `{cat $D/replyto} >> /mail/box/$USER/_bounced >[2] /dev/null
34 rm $TMP
35 exit 0
36 }
38 # don't recognize the sender so hold the message
39 $BIN/deliver $RECIP $D/from /mail/box/$USER/_held < $D/raw
41 rv=$status
42 rm $TMP
43 exit $status