#!/usr/bin/env bash
#
# $Id$
# Author: Gerwin Klein, TU Muenchen
# License: GPL (GNU GENERAL PUBLIC LICENSE)
#
# DESCRIPTION: send email with text attachments.
# (works for "mail" command of SunOS 5.8)
#
PRG="$(basename "$0")"
MIME_BOUNDARY="==PM_=_37427935"
function usage()
{
echo
echo "Usage: $PRG subject recipient
[]"
echo
echo " Send email with text attachments. is a file."
echo
exit 1
}
function fail()
{
echo "$1" >&2
exit 2
}
#
# print_attachment
#
# print mime "encoded" to stdout (text/plain, 8bit)
#
function print_attachment()
{
local FILE=$1
local NAME=${FILE##*/}
cat < []
#
# prints mime "encoded" message with text attachments to stdout
#
function print_body()
{
local SUBJECT=$1
local BODY=$2
shift 2
cat <