Skip to content

Instantly share code, notes, and snippets.

@viatcheslavmogilevsky
Last active March 12, 2026 16:00
Show Gist options
  • Select an option

  • Save viatcheslavmogilevsky/fc4524d27d536282de3a6634281fcbef to your computer and use it in GitHub Desktop.

Select an option

Save viatcheslavmogilevsky/fc4524d27d536282de3a6634281fcbef to your computer and use it in GitHub Desktop.

Gmail filters

Filter calendar invites/updates

  • Query: from:(-me) {filename:vcs filename:ics} has:attachment
  • Do this: Skip Inbox, Apply label "Calendar", Never send it to Spam, Never mark it as important, Categorize as Primary
  • XML entry (from export):
	<entry>
		<category term='filter'></category>
		<title>Mail Filter</title>
		<id>tag:mail.google.com,2008:filter:z123456*7890</id>
		<updated>2026-02-09T18:34:11Z</updated>
		<content></content>
		<apps:property name='hasTheWord' value='from:(-me) {filename:vcs filename:ics}'/>
		<apps:property name='hasAttachment' value='true'/>
		<apps:property name='label' value='Calendar'/>
		<apps:property name='shouldArchive' value='true'/>
		<apps:property name='shouldNeverSpam' value='true'/>
		<apps:property name='shouldNeverMarkAsImportant' value='true'/>
		<apps:property name='smartLabelToApply' value='^smartlabel_personal'/>
		<apps:property name='sizeOperator' value='s_sl'/>
		<apps:property name='sizeUnit' value='s_smb'/>
	</entry>

Filter emails coming to shared email address which don't have given words

  • Query: to:(team@example.com) -{"important alert"}
  • Do this: Skip Inbox, Apply label "To team", Never send it to Spam, Never mark it as important, Categorize as Primary
  • XML entry (from export):
	<entry>
		<category term='filter'></category>
		<title>Mail Filter</title>
		<id>tag:mail.google.com,2008:filter:z123456*7891</id>
		<updated>2026-03-12T15:49:59Z</updated>
		<content></content>
		<apps:property name='to' value='team@example.com'/>
		<apps:property name='doesNotHaveTheWord' value='&quot;important alert&quot;'/>
		<apps:property name='label' value='To team'/>
		<apps:property name='shouldArchive' value='true'/>
		<apps:property name='shouldNeverSpam' value='true'/>
		<apps:property name='shouldNeverMarkAsImportant' value='true'/>
		<apps:property name='smartLabelToApply' value='^smartlabel_personal'/>
		<apps:property name='sizeOperator' value='s_sl'/>
		<apps:property name='sizeUnit' value='s_smb'/>
	</entry>

To be continued

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment