I love the mutt option crypt_opportunistic_encrypt. This allows me to automatically encrypt emails to recipients for whom I have the key. (And not if I cc to a group that contains members without keys.)

However, I'd also like to automatically sign emails that I encrypt. IMO, if a recipient doesn't use PGP generally, I wouldn't encrypt, and signing would just be noise to them. However, if they do use PGP generally, I'd encrypt and sign by default. Is there a way to do this in mutt?

I looked at crypt_autosign, which signs to all, and crypt_replysign and crypt_replysignencrypted, which only deal with replied emails.

1 Answer 1


I had the same problem, the solution I found is:

send-hook . 'reset pgp_autoencrypt'
send-hook "!~l ~t onemail@example\\.org" "set crypt_autoencrypt crypt_autosign"

to automatically encrypt messages to specific recipients, where !~l pattern is to not activate encryption if the mail is also addressed to a known mailing list, and ~t addr means "To: addr".

Note that send-hook is matched against all messages: new and replies.

Some references:

  • 3
    I used to do something similar, but (as hinted in the question) the problem is that it works poorly for emails to multiple recipients. If you have a key for only one recipient, mutt will still try to encrypt (and sign) to all. crypt_opportunistic_encrypt avoids this problem, by not encrypting in this case.
    – Sparhawk
    Jan 5, 2017 at 2:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.