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