1#!/bin/sh
2#
3# Send multiples files non-interactively
4
5# adjust if needed
6attachment_header=`mhparam Attachment-Header`
7
8
9if [ $# -lt 3 ]; then
10    echo 'usage: sendfiles RECIPIENT SUBJECT FILES...' 1>&2
11    exit 1;
12fi
13
14rcpt="$1"
15shift
16subject="$1"
17shift
18
19cat 1>&2 <<!
20Recipient: $rcpt
21Subject:   $subject
22Files:     $*
23!
24
25draft=`mktemp /tmp/sendfiles.XXXXXX`
26trap 'rm -f "$draft"' 1 2 15
27
28anno "$draft" -component To -text "$rcpt" -nodate
29anno "$draft" -component Subject -text "$subject" -nodate
30for i in "$@" ; do
31	anno "$draft" -component  "$attachment_header" -text "$i" -nodate
32done
33
34send "$draft"
35