Label and filter Gmail threads using basic RegEx against the email body or headers.
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 slashesfolder/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 textarchive
- true/false to archive the matching emailsstar
- true/false to star the matching emailsmarkRead
- true/false to mark the matching emails as read
var from = [
"from:email@domain.com",
"list:subscription.domain.com"
];
This can be any combination of Gmail filters to apply the labels against.
You'll need to enable Google App Scripts in your Google Drive account
currently leveraging this companion GMail native filter, to identify emails that the script will process
Matches: ((from:notifications@github.com 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:(author@noreply.github.com OR mention@noreply.github.com OR manual@noreply.github.com ) OR cc:comment@noreply.github.com))
Do this: Apply label "OSS/personal", Categorize as Personal