@J65nko
I used my script for that:
Code:
#! /bin/sh
# subject
SUBJ="$( hostname -s ) | $( basename ${0} ) | report"
__usage() {
echo "usage: $( basename ${0} ) email@domain.com message.txt [file1] [file2]"
exit 1
}
__check_file() {
if [ ! -f "${1}" ]
then
echo "error: file '${1}' does not exist"
exit 1
fi
}
__check_mail() {
if [ ${?} -ne 0 ]
then
echo "error: mail(1) failed to send message"
exit 1
fi
}
[ ! ${#} -ge 2 ] && __usage
__check_file "${2}"
MAIL="${1}"
MESG="${2}"
case ${#} in
(2)
mail -s "${SUBJ}" "${MAIL}" < "${MESG}"
__check_mail
;;
(*)
shift
shift
BODY="$( basename ${0} ).body"
cat "${MESG}" > "${BODY}"
for FILE in "${@}"
do
__check_file "${FILE}"
uuencode "${FILE}" "${FILE}" >> "${BODY}"
done
mail -s "${SUBJ}" "${MAIL}" < "${BODY}"
__check_mail
;;
esac
Of course it can be extended to support subject/cc/bcc ... but nice to know other alternatives as
matts.