Git Product home page Git Product logo

gmail-labeler's Introduction

Gmail Labeler

Label and filter Gmail threads using basic RegEx against the email body or headers.

Configuration

Filters Options

var filters = [
  // star emails deliveredto [email protected]
  { name: 'user emails', match: /deliveredto:[email protected]/, 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

var from = [
  "from:[email protected]",
  "list:subscription.domain.com"
];

This can be any combination of Gmail filters to apply the labels against.

Installation

You'll need to enable Google App Scripts 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

Sample results:

Screenshot from 2016-11-23 17-24-23.png

currently leveraging this companion GMail native filter, to identify emails that the script will process Screenshot from 2016-11-28 11-57-03.png

Matches: ((from:[email protected] OR replyto:users@*apache.org OR replyto:dev@*apache.org) OR replyto:*@*yahoogroups.com OR replyto:*@*lists.jboss.org) AND -label:OSS-personal)
Do this: Apply label "OSS"

Matches:  (ListID:paoloantinori* OR (to:([email protected] OR [email protected] OR [email protected] ) OR cc:[email protected]))
Do this: Apply label "OSS/personal", Categorize as Personal

Quota limits:

https://script.google.com/dashboard

gmail-labeler's People

Contributors

paoloantinori avatar

Watchers

Sai Lavu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.