Programming, philosophy, pedaling.

Self-encrypted mail in NeoMutt (with GPGme)

Mar 7, 2019

Tags: howto, rant

This is a very short post. It refers to NeoMutt, but will probably work with plain old Mutt as well.

TL;DR: You can't self-encrypt in NeoMutt via GPGme. You have to use encrypt-to in your gpg.conf. See man gpg for how to use encrypt-to, or just read the bottom of this post.

I just spent the last two hours trying to figure out how to self-encrypt my mail in NeoMutt. I want this because I want to be able to see my own messages after I send them, which doesn't strike me as a particularly unreasonable thing to want.

If I was using the (old) PGP interface, I would do something like this:

set pgp_default_key = 0xWHATEVER
set pgp_use_gpg_agent = yes
set pgp_self_encrypt = yes
# probably other commands, plus inevitable gpg vs. gpg2 hell

But I don't want to do that, I want to use GPGme. With GPGme, the only setting I need is:

set crypt_use_gpgme = yes

...and everything just works™. Except self-encrypt, of course: pgp_self_encrypt has no effect on the GPGme interface.

Here are the only two references I could find to others having this problem:

The second link has the answer: there is no current way to self-encrypt via GPGme from within NeoMutt. Seeing how that message is 11 years old at the time of writing, I suspect that there never will be.

The workaround is to use encrypt-to with your fingerprint within your gpg.conf (usually ~/.gnupg/gpg.conf):

encrypt-to 0xWHATEVER

This is bad for obvious reasons: now all of my PGP-encrypted files are self-encrypted, and I still don't have any way to do self-encryption for individual mailboxes. But it works, and it's not like I'm really doing anything other than email with my PGP key anyways.