Gmail Blade is a sidecar with advanced and precise filtering for your Gmail account. Utilizing the expressiveness of expr-lang/expr to fully customize your Gmail experience. Make Gmail great again!
I am an inbox-zero guy, I rely on emails for all my notifications because the nature of emails is working asynchronously. I absolutely hate red dots and I disabled all of them. Unfortunately, native Gmail filters do not support precise filtering, and works more like a "search engine" over the emails, with fuzz matches, that creates lots of false positives. The speed of the email processing directly impact my productivity.
Why I have waited so long? Every side project needs a kick, and Sourcegraph Amp did this one for me, I want to try it for a small project from scratch, and here it is.
A YAML configuration file is expected (default gmail-blade.yml in the working directory), and below is an example:
Please refer to expr-lang/expr for the syntax manual, available variables are as follows:
| message | Message | The email message |
Type Message:
| from | []string | The list of from addresses, e.g. ["[email protected]"] |
| fromName | []string | The list of from names, e.g. ["Joe Chen"] |
| subject | string | The email subject |
| cc | []string | The list of cc addresses, e.g. ["[email protected]", "[email protected]"] |
| to | []string | The list of to addresses, e.g. ["[email protected]"] |
| body | string | The email body |
If halt-on-match is true, then it will be the last action to take upon matching.
Note
Gmail mailboxes and labels must already exist in your Gmail settings. You can use gmail-blade list-mailboxes to get all your mailboxes and labels.
| move to "X" | Move the message to the "X" mailbox, e.g. move to "[Gmail]/Spam" |
| label "X" | Add label "X" to the message, e.g. label "GitHub" |
| delete | Delete the message, shortcut for move to "[Gmail]/Trash" |
Actions are executed in the same order as they are defined. You will get marginal performance benefit if you put halt-on-match ones on the top.
The sidecar only looks at unread emails.
To run the sidecar once, do gmail-blade once. To test your filters, you can dry run with gmail-blade once --dry-run --debug.
To run the sidecar as a long-running service, do gmail-blade server, it pauses 30s after each run. It also supports --dry-run and --debug if you want to.
Use --help flag to get helper information on gmail-blade and its subcommands.
This project is under the MIT License. See the LICENSE file for the full license text.
.png)


