citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

commit 6f1528eee28bfe11abb1289edb63b9db97966acc
parent 656298a2b42a323519aac4a1f9e9d56bf933c372
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 12 Apr 2021 08:42:31 -0700

sendmail: notify on queued mail

Diffstat:
Mbin/sendmail | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/bin/sendmail b/bin/sendmail @@ -4,7 +4,15 @@ export EMAIL_CUSTOM_CONN_TEST=/home/jb55/bin/email-conn-test export EMAIL_CONN_TEST=c # pass all params to msmtpq & redirect output -msmtpq "$@" >> /tmp/msmtp.log 2> /tmp/msmtp.err +output=$(msmtpq "$@" 2> /tmp/msmtp.err) +echo "$output" >> /tmp/msmtp.log + +if grep -E '^\s+enqueued' <<<"$output" +then + if command -v notify-send &> /dev/null; then + notify-send -u critical "$output" + fi +fi # always succeed, even on connection/mail failure # we'll simply queue the mail in our outbox