#!/bin/bash MAILER="cantfind" for executable in sendmail msmtp do for prefix in /usr/bin /usr/sbin /bin /sbin do [ "${MAILER}" == "cantfind" ] && [ -x ${prefix}/${executable} ] && MAILER="${prefix}/${executable}" done done if [ "${MAILER}" == "cantfind" ] then >&2 echo 'ERROR: Can\'t find suitable mailer.' exit 1 fi ( . /etc/sendmailadvanced.conf tos="" while read s do echo "${s}" if [ "${s:0:3}" == "To:" ] || [ "${s:0:3}" == "Cc:" ] then tos="${tos} ${s:4}" fi if [ "${s:0:8}" == "Subject:" ] then break fi done hashcash -b ${hashcash_bits} -Xm ${tos} while read s do echo "${s}" if [ "${s}" == "" ] then break fi done ( body_header_hook $@ cat body_footer_hook $@ ) | gpg -e -a -s -r ${gpg_recipient} ) | ${MAILER} -t