Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
/opt/bin/mail2pgp.sh
#!/bin/bash
#hook ${sender} ${size} ${recipient}
LOG="/tmp/mail2pgp.log"
FROM=$1
SIZE=$2
TO=$3
PGP_KEY="F8FE7407"
FORWARD=""
echo ----------------------------- >> $LOG
date >> $LOG
echo "From: $FROM" >> $LOG
echo "Size: $SIZE" >> $LOG
echo "To: $TO" >> $LOG
case $TO in
"mcgrof@encrypted.ninja")
PGP_KEY="58254BAC"
FORWARD="mcgrof@suse.com"
PGP_KEY="047A60A0"
FORWARD="mcgrof@do-not-panic.com"
;;
*)
exit
;;
esac
cat - | procmail -m PGP_KEY=$PGP_KEY FWD_TO=$FORWARD /opt/mail2pgp/.procmailrc
echo "Exit status from procmail: $?" >> $LOG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment