citadel

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

sendmail-bg (726B)


      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="$1"
      7 shift
      8 
      9 #from_email=$(<"$file" grep '^From:' | sed -n 's,.*<\([^>]\+\)>.*,\1,p')
     10 #from_email=${from_email:-"jb55@jb55.com"}
     11 
     12 #<"$file" /home/jb55/bin/hashcash-mail "$from_email" > "$file2"
     13 
     14 # pass all params to msmtpq & redirect output
     15 notmuch insert +inbox < "$file"
     16 output=$(<"$file" msmtpq "$@" 2> /tmp/msmtp.err)
     17 echo "$output" >> /tmp/msmtp.log
     18 
     19 if grep -E '^\s+enqueued' <<<"$output"
     20 then
     21 	if command -v notify-send &> /dev/null; then
     22 		notify-send -u critical "$output"
     23 	fi
     24 fi
     25 
     26 rm -f "$file" "$file2"
     27 
     28 # always succeed, even on connection/mail failure
     29 # we'll simply queue the mail in our outbox
     30 exit 0