Skip to content

marckassay/GmailFilterUtil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GmailFilterUtil

This module has been created to address the following:

  • Unable to edit large filter lists in Gmail. It seems that Gmail doesn't allow editing large filter sets without receiving an error popup. For whatever reason why this is, I "quickly" created this module because of it.
  • Quickly update Gmail filter list. Although, this requires additional steps to be done in Gmail, this module allows you to update your local Xml filter file to be uploaded anytime afterwards. Use the Add-FromList function to add new entries.
  • To have predefined Gmail filter lists. From the plethora of recruiters contacting me, I found myself inundated to the point I was avoiding to view my inbox. Filters are a powerful tool in Gmail, so that you can avoid even seeing or needing to delete messages, which is what I needed to filter recruiter messages. Having predefined lists makes enabling this process much less painful. Submit a PR to update or add new lists!

GitHub license PS Gallery

Examples

In order to use this PowerShell module, you must download an initial filter from a Gmail account. It may be empty. Or it may just have a single entry. If needed, instructions can be found here on managing Gmail filters.

When you have a exported filter from your Gmail account, you can update it by doing this following:

Import-XmlFilter -Path 'C:\temp\mailFilters.xml' | `
  Add-FromList -Value "*@aerotek.com" | `
  Export-XmlFilter -Path 'C:\temp\mailFilters.xml'

This example uses the Add-FromList function to add additional entries, as to juxtapose with Set-FromList, which sets the value of Value parameter as-is, removing any existing values. This function-verb behavior aligns with PowerShell's Add-Context and Set-Context functions.

Another example, is to use a predefined list of entries. For instance, the recruiters.us list:

$RecruiterEntries = Read-PredefinedFromList -ListName 'recruiters.us'
$RecruiterEntries += '*@techcorpsystems.com'
$RecruiterEntries | Export-XmlFilter -Path 'C:\temp\mailFilters.xml'

Above, an additional entry is added to GmailFilter data type and exported back to mailFilter.xml file.

API

Adds entries to a From list.

Exports PowerShell data back to Gmail exported filter.

Imports into PowerShell session, a Gmail exported filter.

{{Fill in the Synopsis}}

Sets entries to a From list.

Releases

No releases published

Packages

No packages published