Replaced sendfiles with a simpler version that uses send instead of viamail.
[mmh] / uip / sendfiles.sh
diff --git a/uip/sendfiles.sh b/uip/sendfiles.sh
new file mode 100755 (executable)
index 0000000..40d8f72
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# Send multiples files non-interactively
+
+# adjust if needed
+attachment_header='Attach'
+
+
+if [ $# -lt 3 ]; then
+    echo 'usage: sendfiles RECIPIENT SUBJECT FILES...' 1>&2
+    exit 1;
+fi
+
+rcpt="$1"
+shift
+subject="$1"
+shift
+
+cat 1>&2 <<!
+Recipient: $rcpt
+Subject:   $subject
+Files:     $*
+!
+
+draft=`mktemp /tmp/sendfiles.XXXXXX`
+trap 'rm -f "$draft"' 1 2 3 15
+cat >"$draft" <<!
+To: $rcpt
+Subject: $subject
+!
+for i in "$@" ; do
+       echo "$attachment_header: $i" >>"$draft"
+done
+
+send "$draft"