https://github.com/johnagan/gmail-labeler
Label and filter Gmail threads using basic RegEx against the email body or headers.
https://github.com/johnagan/gmail-labeler
Last synced: 10 months ago
JSON representation
Label and filter Gmail threads using basic RegEx against the email body or headers.
- Host: GitHub
- URL: https://github.com/johnagan/gmail-labeler
- Owner: johnagan
- License: mit
- Created: 2015-12-06T14:21:02.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-12-06T15:09:01.000Z (over 10 years ago)
- Last Synced: 2025-06-05T13:04:43.891Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 10.7 KB
- Stars: 55
- Watchers: 5
- Forks: 19
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Gmail Labeler
Label and filter Gmail threads using basic RegEx against the email body or headers.
## Configuration
#### Filters Options
```javascript
var filters = [
// star emails deliveredto user@domain.com
{ name: 'user emails', match: /deliveredto:user@domain.com/, star: true },
// organize by list name
{ match: /(?:List-ID:\s(.+?)\s<)/, archive: true },
// label all emails with "bank" in the subject as "finance" and mark as read
{ name: 'finance', subject: 'bank', markRead: true },
];
```
* `name` - The label name to apply when matched. This can also be nested by adding slashes `folder/name`. If no name is set, it will use the first RegEx selector result (.+?)
* `match` - The RegEx to match against. This searches the entire raw contents of the email, including the header. Include a RegEx selector to return dynamic label names (.+?)
* `subject` - Helper to search the subject for text
* `archive` - true/false to archive the matching emails
* `star` - true/false to star the matching emails
* `markRead` - true/false to mark the matching emails as read
## From
```javascript
var from = [
"from:email@domain.com",
"list:subscription.domain.com"
];
```
This can be any combination of [Gmail filters](https://support.google.com/mail/answer/7190?hl=en) to apply the labels against.
## Installation
_You'll need to enable [Google App Scripts](https://script.google.com) in your Google Drive account_
#### Create a new Google App Script

#### Paste the labeler.gs contents into the new file and Save

#### After savings, create a new trigger

#### Run the `labeler` function every minute
