Encrypt/decrypt mail using GPG/MIME. Takes an email from stdin and outputs to stdout. Written to be used as a Sieve filter through sieve_extprograms.
Find a file
2024-11-23 02:54:50 +00:00
.gitignore gitignore some testing files 2024-11-14 17:39:25 +00:00
.pre-commit-config.yaml pre-commit hooks 2024-11-06 22:53:20 +00:00
gpgmymail gpgmymail: remove all 'decoding' code 2024-11-23 02:54:50 +00:00
LICENCE initial commit 2024-11-04 16:24:24 +00:00
README.md update README to better describe my changes 2024-11-16 15:52:32 +00:00
requirements.txt requirements 2024-11-04 16:31:40 +00:00

gpgmymail

Takes an email from stdin and encrypts it to stdout using the recipient's PGP key, provided as an argument when calling the script.

Leaves a X-gpgmymail-Status header on the email, which has the following statuses:

  • entered - the email has entered the encryption function, but not been encrypted
  • encrypted - the encryption function has encrypted the email

Written to be a Sieve filter to be used with sieve_extprograms. Can be used in a Sieve filter e.g.:

require ["vnd.dovecot.filter"];
filter "gpgmymail" "pid1@revsuine.xyz";

Will encrypt all incoming mail with the pid1@revsuine.xyz PGP key.

TODO link my blog post when I make it fully explaining how to use as Sieve filter.

I use this script on my own mail server so this should be maintained to work with the up-to-date versions of Python and python-gnupg

Requirements

Notes on Scope

Since this script is written to be used as a Sieve filter, no exclusion behaviour which is much better achieved with Sieve will be implemented, e.g. "do not encrypt emails from kate@gmail.com".

Credits

  • Julian Klode for the original code
  • revsuine for modifications to gpgmymail, mostly to make it work well with Thunderbird