Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jessfraz/gmailfilters
A tool to sync Gmail filters from a config file to your account.
https://github.com/jessfraz/gmailfilters
Last synced: 15 days ago
JSON representation
A tool to sync Gmail filters from a config file to your account.
- Host: GitHub
- URL: https://github.com/jessfraz/gmailfilters
- Owner: jessfraz
- License: mit
- Created: 2018-12-29T06:35:33.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-25T00:56:55.000Z (over 1 year ago)
- Last Synced: 2024-08-04T02:10:22.406Z (3 months ago)
- Language: Go
- Size: 4.23 MB
- Stars: 549
- Watchers: 15
- Forks: 34
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# gmailfilters
[![make-all](https://github.com/jessfraz/gmailfilters/workflows/make%20all/badge.svg)](https://github.com/jessfraz/gmailfilters/actions?query=workflow%3A%22make+all%22)
[![make-image](https://github.com/jessfraz/gmailfilters/workflows/make%20image/badge.svg)](https://github.com/jessfraz/gmailfilters/actions?query=workflow%3A%22make+image%22)
[![GoDoc](https://img.shields.io/badge/godoc-reference-5272B4.svg?style=for-the-badge)](https://godoc.org/github.com/jessfraz/gmailfilters)
[![Github All Releases](https://img.shields.io/github/downloads/jessfraz/gmailfilters/total.svg?style=for-the-badge)](https://github.com/jessfraz/gmailfilters/releases)A tool to sync Gmail filters from a config file to your account.
> **NOTE:** This makes it so the single configuration file is the only way to
add filters to your account, meaning if you add a filter via the UI and do not
also add it in your config file, the next time you run this tool on your
outdated config, the filter you added _only_ in the UI will be deleted.**Table of Contents**
- [Installation](#installation)
- [Binaries](#binaries)
- [Via Go](#via-go)
- [Usage](#usage)
- [Example Filter File](#example-filter-file)
- [Setup](#setup)
- [Gmail](#gmail)## Installation
#### Binaries
For installation instructions from binaries please visit the [Releases Page](https://github.com/jessfraz/gmailfilters/releases).
#### Via Go
```console
$ go get github.com/jessfraz/gmailfilters
```## Usage
```console
$ gmailfilters -h
gmailfilters - A tool to sync Gmail filters from a config file to your account.Usage: gmailfilters
Flags:
-d, --debug enable debug logging (default: false)
-e, --export export existing filters (default: false)
-f, --creds-file Gmail credential file (or env var GMAIL_CREDENTIAL_FILE) (default: )
-t, --token-file Gmail oauth token file (default: /tmp/token.json)Commands:
version Show the version information.
```## Example Filter File
```toml
[[filter]]
query = "to:[email protected]"
archive = true
read = true[[filter]]
query = "from:[email protected] LGTM"
label = "github/LGTM"[[filter]]
query = """
(-to:[email protected] \
(from:([email protected]) AND (@jfrazelle OR @jessfraz OR to:[email protected] OR to:[email protected] OR to:[email protected])))
"""
label = "github/mentions"[[filter]]
query = """
to:[email protected] \
-to:[email protected] \
-to:[email protected] \
-to:[email protected]
"""
label = "github/team-mention"[[filter]]
query = """
from:[email protected] \
-to:[email protected] \
-to:[email protected] \
-to:[email protected] \
-to:[email protected]
"""
archive = true[[filter]]
query = "(from:me AND to:[email protected])"
label = "github/mentions"[[filter]]
query = "(from:[email protected])"
label = "github"[[filter]]
queryOr = [
"to:[email protected]",
"to:[email protected]",
"to:[email protected]",
"to:[email protected]"
]
delete = true[[filter]]
queryOr = [
"from:[email protected]",
"from:[email protected]",
"from:[email protected]"
]
label = "to-be-deleted"[[filter]]
query = "[email protected] OR (subject:\"Invitation to comment\" AND from:me ) OR from:(*@docs.google.com)"
label = "to-be-deleted"[[filter]]
query = "(from:(-me) {filename:vcs filename:ics} has:attachment) OR (subject:(\"invitation\" OR \"accepted\" OR \"tentatively accepted\" OR \"rejected\" OR \"updated\" OR \"canceled event\" OR \"declined\") when where calendar who organizer)"
label = "to-be-deleted"[[filter]]
query = "list:[email protected]"
label = "Mailing Lists/coreos-dev"
archiveUnlessToMe = true[[filter]]
queryOr = [
"list:[email protected]",
"list:[email protected]"
]
label = "Mailing Lists/xdg-apps"
archiveUnlessToMe = true
```## Setup
### Gmail
1. Enable the API: To get started using Gmail API, you need to
first create a project in the
[Google API Console](https://console.developers.google.com),
enable the API, and create credentials.Follow the instructions
[for step enabling the API here](https://developers.google.com/gmail/api/quickstart/go).