File: sys_sendmail.sh

package info (click to toggle)
bayonne 2.3.2-3
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 11,180 kB
  • ctags: 3,662
  • sloc: cpp: 38,791; sh: 9,323; ansic: 1,391; makefile: 485; perl: 471; java: 405; cs: 402; php: 354; python: 293
file content (72 lines) | stat: -rw-r--r-- 1,056 bytes parent folder | download
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
sender="$SMTP_SENDER"
sendmail="$SMTP_SENDMAIL"
errors="$SMTP_ERRORS"
body="$ARGS_TMP"
to="$ARGS_TO"
cc="$ARGS_CC"
reply="$ARGS_REPLY"
dest="$to"
from="$ARGS_FROM"
subject="$ARGS_SUBJECT"
file="$ARGS_PATH"
mime=""

if test ! -z "$file" ; then
	if test ! -f ${file} ; then
		echo "$PORT_TSESSION error file-missing"
		exit 0
	fi
	case ${file} in
	*.au|*.au)
		mime="audio/basic"
		;;
	*.txt|*.text|*.log)
		mime="text/plain"
		;;
	*.wav)
		mime="audio/x-wav"
		;;
	*.mp3)
		mime="audio/mpeg"
		;;
	*.gif)
		mime="image/gif"
		;;
	*.tif|*.tiff)
		mime="image/tiff"
		;;
	*.jpg|*.jpeg)
		mime="image/jpeg"
		;;
	*.htm|*.html)
		mime="text/html"
		;;
	*.xml)
		mime="application/xml"
		;;
	*.png)
		mime="image/png"
		;;
	*.xpm)
		mime="image/xpm"
		;;
	esac
fi		

if test ! -z "$cc" ; then
	$dest="$dest $cc" ; fi

if test ! -x ${sendmail} ; then
	rm -f $tmp
	echo "$PORT_TSESSION error sendmail-missing"
	exit 0
fi

btsencode -e "$errors" -f "$from" -t "$to" -c "$cc" \
	-s "$subject" -b "$body" -m "$mime" -a "$file" | \
		${sendmail} -f $sender $dest