2 ## Common used functions library
12 # Print the error message in standard error output
20 echo -e "Error: $str" >> /dev
/stderr
32 # Calls die() if return code is not zero
39 if [ $retcode -ne 0 ]; then
49 # Returns: sendmail's exit code
51 # Send an e-mail to the address specified in the TO_ADDR variable
52 # from the address specified in the FROM_ADDR
54 # Note that sendmail must be proper installed
62 tmpfile
=/tmp
/email.XXXXXXXXXX
63 emailfile
=$
(mktemp
$tmpfile)
65 die_on_error $?
"Could not create temporary e-mail file"
67 echo -e "To: $to\nFrom: $from" > $emailfile
68 echo -e "Subject: $subject" >> $emailfile
69 echo -e "Content-type: text/plain\n\n" >> $emailfile
70 echo -e "$contents\n." >> $emailfile
72 cat $emailfile |
$SENDMAIL -t