#! /bin/sh
##
## $Id: vboxnotify,v 1.2 1996/07/25 12:34:02 root Exp $
##
## *Sample* script to notify user about new mail. You can use this script
## with the option -p from vboxgetty.
##
## Make sure that all needed programs are in the search path!
##
## Usage: vboxnotify SAMPLENAME CALLERID [MAIL-TO-ADDRESS]

PATH="${PATH}:/usr/local/lib/vbox"

SAMPLE="${1}"
NUMBER="${2}"
MAILTO="${3}"

if [ "${MAILTO}" = "" ]
then
   if [ "${USER}" != "" ]
   then
      MAILTO="${USER}"
   fi
fi

if [ "${MAILTO}" = "" ]
then
   echo "Can't find email address to mail message."
   exit
fi

(
   echo "From: ${NUMBER}"
   echo "Name: ${SAMPLE}"
   echo "Size: `filesize ${SAMPLE}`"

) | mail -s "New voice message (${NUMBER})" ${MAILTO}
