forked from moshix/UnixNJE
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmailify.sh
More file actions
56 lines (49 loc) · 1.13 KB
/
mailify.sh
File metadata and controls
56 lines (49 loc) · 1.13 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
#
# mailify.sh -- do it simple mailify utility by using intelligent
# subprograms - and letting mailer do most...
# Copyright (c) Finnish University and Research Network, FUNET 1991, 1993,1994
#
nodel=0
TMPFILE=/usr/tmp/mlfy$$.tmp
TMPLOG=/dev/null
TMPLOG=/usr/tmp/mailify.runlog
#touch $TMPLOG
if [ "x$1" = "x-n" ]; then
shift; nodel=1
fi
telusage=0
if [ "x$1" != "x" ]; then
if [ ! -r $1 ]; then
telusage=1
fi
else
telusage=1
fi
if [ $telusage = 1 ]; then
echo "MAILIFY - program for HUJI-NJE incoming mail processing"
echo " Not for casual users invocation."
echo "Args: [-n] spoolfilepath"
echo " -n for no original file removal."
exit 3
fi
(
echo "Mailify: $*"
/usr/local/bin/receive -a -n -o $TMPFILE $1
rc=$?
if [ $rc != 0 ]; then exit $rc; fi
headword="`head -1 $TMPFILE|cut -c-5`"
if [ "$headword" = "HELO " ]; then
# Zmailer interface module, your mileage may vary..
/usr/lib/sendmail -v -bs 2>&1 < $TMPFILE
else
/usr/lib/sendmail -bm 2>&1 < $TMPFILE
fi
rc=$?
rm $TMPFILE
if [ $nodel = 1 ]; then exit 0; fi
if [ $rc != 0 ]; then exit $rc; fi
/bin/rm -f $1
exit 0
) >> $TMPLOG
exit $?