====== Actions for Claws-Mail ======
[[https://www.claws-mail.org|Claws]] is GTK-based mail client offering lots of features and allowing broad customization. Actions are used for executing specific actions with regards to one or more mails. Actions can be defined via ''Configuration'' -> ''Actions''. They can be executed in ''Extras'' -> ''Execute action''.
===== Import Autocrypt key =====
[[https://autocrypt.org/|Autocrypt]] aims to standardize some characteristics of how mail clients deal with mail encryption (e.g. automatic exchange of public keys). Mail clients supporting automatic key exchange embed the public key of the sender in each message as part of the ''Autocrypt'' header. The following action parses this header and imports the contained key into the gpg keyring.
cat "%f" | python3 -c 'import base64, email, sys; raw_mail = email.message_from_string(sys.stdin.read()); [sys.stdout.buffer.write(base64.b64decode(item.split("=", 1)[1])) for item in raw_mail.get("Autocrypt", "").replace("\n ", "").split("; ") if item.startswith("keydata=")]' | gpg --import
===== Decrypt inline GPG mail =====
Decrypt the content of an inline-encrpyted mail and visualize the result in the mail window.
*gpg --no-tty --command-fd 0 --passphrase-fd 0 --decrypt %p|
===== Show Encryption Key IDs =====
Sometimes the sender picks the wrong target key while encrypting a mail. The following action visualizes the IDs of the keys used for encrypting the message.
cat %p | gpg --batch --decrypt --list-only --status-fd 1 2>/dev/null | awk '/^\[GNUPG:\] ENC_TO / { print $3 }' | while read keyid; do echo "$keyid"; gpg --list-keys "$keyid"; echo; done
===== Import GPG key =====
Import the plain gpg from a mail text or attachment.
gpg --import %p