Add Claws Mail and todo

This commit is contained in:
askiiart 2024-02-27 22:57:16 -06:00
parent 23da552d54
commit 16c67ee819
Signed by untrusted user who does not match committer: askiiart
GPG key ID: BC3800E55FB54D67

View file

@ -4,10 +4,41 @@ This is just a little script to automatically find and import the public key use
## Usage ## Usage
Just run it with the email file, like this: Just install the dependencies, then run it with the email file, like this:
```sh ```sh
python3 ./gpg-email-helper.py ~/Mail/inbox/10 python3 ./gpg-email-helper.py ~/Mail/inbox/10
``` ```
You can view the log at `$XDG_DATA_HOME/gpg-email-helper/log` or `~/.local/share/gpg-email-helper/log`. You can view the log at `$XDG_DATA_HOME/gpg-email-helper/log` or `~/.local/share/gpg-email-helper/log`.
## Claws Mail
I use this Claws Mail filtering rule, it runs grep first to check if the email contains a signature, which helps speed it up when you have to run it in bulk. Just add it to `~/.claws-mail/matcherrc` under `[filtering]`
```text
enabled rulename "Run gpg-email-helper" test "grep -- \"-----BEGIN PGP SIGNATURE-----\" %F" execute "python3 {SCRIPT LOCATION}/gpg-email-helper.py %F"
```
Or to add it in the GUI:
1. Go to Configuration -> Filtering
2. Add a title (such as "Run gpg-email-helper")
3. Enter `test "grep -- \"-----BEGIN PGP SIGNATURE-----\" %F"` for the condition.
4. Enter `execute "python3 {SCRIPT LOCATION}/gpg-email-helper.py %F"` for the action.
5. Click "Add"
6. Click "OK"
### Processing (old) emails in bulk
With a filtering rule, Claws Mail will only run gpg-email-helper when it receives a new email (that contains a signature). To run it on all emails instead, you can add the rule to pre/post-processing instead, but can take upwards of a minute to load every time you open your inbox, can cause the POP3/IMAP connection to time out, and often just crashes Claws Mail. Instead, I'd just just running it manually if you want to import public keys from all your old emails.
In bash, run this to run gpg-email-helper on all files with a signature:
```bash
for item in $(ls $HOME/Mail/inbox/); do if [ $(grep -c -- "-----BEGIN PGP SIGNATURE-----" $HOME/Mail/inbox/$item) != 0 ]; then python3 {SCRIPT LOCATION}/gpg-email-helper.py $HOME/Mail/inbox/$item; fi; done
```
## Todo
- Add async to get the key from all keyservers simultaneously