Search code examples
muttneomutt

Always attach PGP public key to outgoing emails


I'd like to always attach my PGP public key to outgoing emails, regardless of encryption/signing status. My vague hope is to encourage recipients to use it, or to get a dialog popup from their mail client to import it & encrypt future emails.

To do this manually, type ESC+k in the compose window and choose your key ID.

How can this be automated?


Solution

  • Use a macro to override the shortcut y for send-message.

    macro compose y "<attach-key>`echo DJG53DFL...`<enter><enter><send-message>"
    

    Echoing the ID of the PGP key allows narrowing down the attach-key dialog options so that a double <enter> effectively selects the proper key.