If you’re like me, then you enjoy categorizing and sorting your email so that you can quickly find important emails, and quickly.
One advantage that I have is the ability to access the filestore on which my email resides. Meaning, I don’t use any protocols like IMAP to access my mail. Instead, all of my mail gets delivered to a directory on my mail server which I can log into to view and or modify my mail.
Downloading the scripts
Running the script
There are a few hardcoded assumptions made by the script.
- it assumes that you’re executing it from the path in which it is located.
- it assumes that the rule files are located in the same directory as the script
- it assumes that the “lib” dir exists as a subdirectory of the directory in which the script resides.
Unless you change anything, this is how it is setup in the git repo, so nothing should require any modification.
Find is your friend
Because the “*” BASH variable craps out at around 1000, we will use the find command and the “xargs” command to help us parse our mail.
What we are seeing is the result of our LinkedIN rule:
You see that we can easily place any regex within the quotes to be matched against the body of the message. The plugins also support header checks, and you can view the code to the Perl module to see how to define those.
Sure, this is re-inventing the wheel. There are already plenty of good email filtering software out there that you can use, but I find it useful to write my own tools from time to time to ensure that I’m getting exactly what I need. Sometimes a custom tool is worth the effort to create.