So I've written a quick hack. A client-side filter/utility program for working against IMAP servers.
Consider it a general purpose system which is similar to Procmail, but applied after your remote machine has already done the sorting.
Here's a flavour:
<GMail>
username somebody.like.me
password yeah.right
</Gmail>
<Folders>
<livejournal>
unread exec /usr/local/bin/notify "Livejournal Comment"
mark read
</livejournal>
<inbox>
mark read
</inbox>
</Folder>
What does that do? It first of all logs into GMail with the given username and password, then selects two folders:
- =livejournal/
For each unread message in the folder it runs the specified command with STDIN being the message body.
Then it marks each new message as "read".
- =inbox/
This simple rule just marks all messages as read.
Why? Well I have a bunch of folders on a bunch of gmail accounts and I don't pay attention to them - but some, specific, mails should result in an SMS being sent to me ... so I need to do something clever.
I'm sure with a bit of effort this could be made IMAP-server independent, and could have a more flexible matching system. The simplicity right now comes about primarily because i dont want to parse a config file.
Anyway, suggestions for potential features are welcome. It does what I need as-is, even if it isn't pretty.
ObQuote: Lost Boys
D'oh!
I did search, but managed to fail to spot that. It looks great, with one minor exception - I dont want to write a program to process the mails, I want to write a rules file.
Other than that though ideal. I even like/love lua!
My specific goal was do do simple things like:
I guess there are more general things you could do, such as matching body-text, etc, which would be fun to add, but not required by me personally.
I will need to think which is least effort:
All my code is very clean and minimal, thanks to Net::Imap::Simple[::SSL] so I'd not be too upset to abandon it!