1

I'm trying to make mutt use a specific GPG key when sending mails to a specific recipient, much like "per-recipient rules" in OpenPGP / Enigmail. For example, if I want to send an email to [email protected] I want to encrypt it with the public key 0xDEADBEEF and when I send an email to [email protected] I want to encrypt it with some other public key 0xBA5EBA11.

To this end, I include the following lines in my ~/.mutt/muttrc file:

send-hook '~t ^coworker@company\.com$' 'set crypt_autoencrypt ; set crypt_autosign'
crypt-hook '~t ^coworker@company\.com$' '0xDEADBEEF'
send-hook '~t ^loveydovey@home\.net$' 'set crypt_autoencrypt ; set crypt_autosign'
crypt-hook '~t ^loveydovey@home\.net$' '0xBA5EBA11'

The send-hook works as expected, but I still always have to pick the key. How can I make mutt choose the key as defined by crypt-hook?

1 Answer 1

1

crypt-hook's pattern is a recipient, so remove ~t from the pattern, it's not needed:

crypt-hook '^coworker@company\.com$' '0xDEADBEEF'
2
  • 1
    Thanks! Is there any way to skip the confirmation question ('Use keyID ... ?') without any patches?
    – ryyst
    Commented Jan 7, 2014 at 10:25
  • Sorry, I don't know.
    – mkucharski
    Commented Jan 14, 2014 at 3:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .