#!/usr/bin/env bash
set -a; source ~/credentials.env; set +a

# requires * credentials.env
#          * msmtp and .msmtp config
#          * mutt and .muttrc with: set sendmail = "/usr/bin/msmtp"

TO="alice@otherhost.com"
SUBJECT="backup error"
ATTACHMENT="./screenshot.png"

mutt -e "set from='$SMTP_MAIL'" \
     -s "$SUBJECT" \
     -a "$ATTACHMENT" \
     -- $TO << EOF
The backup script failed.
Pleaee see this screenshot.
EOF
