Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tastytea
Last active September 11, 2017 00:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tastytea/6aae62187ac1250f9e05fd361e8d29f5 to your computer and use it in GitHub Desktop.
Save tastytea/6aae62187ac1250f9e05fd361e8d29f5 to your computer and use it in GitHub Desktop.
procmail auto-encrypt
--MfFXiAuoTsnnDAfX
This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156)
--MfFXiAuoTsnnDAfX
Content-Type: application/pgp-encrypted
Content-Disposition: attachment
Content-Description: PGP/MIME version identification
Version: 1
--MfFXiAuoTsnnDAfX
Content-Type: application/octet-stream; name="msg.asc"
Content-Description: OpenPGP encrypted message
Content-Disposition: inline; filename="msg.asc"
# Thanks to <https://www.j3e.de/pgp-mime-encrypt-in-procmail.html>
:0 H
# modify your filter, which mails to encrypt, here:
* ^Subject: encryptme
{
MYHDRS=`formail -XContent-Type: -XContent-disposition: -XContent-transfer-encoding:`
# replace with your PGP key ID here:
RECIPIENT="1C17FF57D51F1277304905DA9C63B7474B4D9FB5"
:0 fh
| formail -I 'Content-Type: multipart/encrypted; protocol="application/pgp-encrypted";boundary="MfFXiAuoTsnnDAfX"' -I Content-transfer-encoding: -I Content-disposition:
:0 fb
| { cat ~/.gpg-mime-start ; { echo "$MYHDRS" ; echo ; cat - ; } | gpg --batch --quiet --always-trust -a -e -r ${RECIPIENT}; cat ~/.gpg-mime-end; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment