Skip to content

Instantly share code, notes, and snippets.

@guns
Created November 23, 2013 20:50
Show Gist options
  • Save guns/7619783 to your computer and use it in GitHub Desktop.
Save guns/7619783 to your computer and use it in GitHub Desktop.
Encrypt mail only to recipients with public keys
# Encrypt mail only to recipients with public keys
set my_cryptlist=`gpg --list-keys | ruby -e '\
puts $stdin.read.scan(/<(.*?)>/)\
.map { |(e)| "\\\\\\\\<%s\\\\\\\\>" % Regexp.escape(Regexp.escape(Regexp.escape(e))) }\
.join("\\\\|")'`
send-hook ~A "set crypt_autoencrypt=no"
send-hook "~t ($my_cryptlist)" "set crypt_autoencrypt=yes"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment