citadel

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

sendmail (593B)


      1 #! /usr/bin/env sh
      2 
      3 export EMAIL_CUSTOM_CONN_TEST=/home/jb55/bin/email-conn-test
      4 export EMAIL_CONN_TEST=c
      5 
      6 #file="$(mktemp)"
      7 #cat > "$file"
      8 #sendmail-bg "$file" -t --read-envelope-from "$@" & disown
      9 
     10 if [ "$1" = "--help" ]; then
     11 	/run/current-system/sw/bin/sendmail "$@"
     12 	exit 1
     13 fi
     14 
     15 output=$(msmtpq "$@" 2> /tmp/msmtp.err)
     16 echo "$output" >> /tmp/msmtp.log
     17 
     18 if grep -E '^\s+enqueued' <<<"$output"
     19 then
     20 	if command -v notify-send &> /dev/null; then
     21 		notify-send -u critical "$output"
     22 	fi
     23 fi
     24 
     25 
     26 # always succeed, even on connection/mail failure
     27 # we'll simply queue the mail in our outbox
     28 exit 0