Before I probably reinvent the wheel, can anyone tell me if there exists a FOSS code library to check email on a regular basis (or driven by a cron job), to parse the title and body and to perform certain functions (mainly sending other emails).
I was thinking PHP as it is server side and good at string handling, but I would be happy enough with C or C++.
Hmmm, why am I even thinking server side? I suppose that it could just as well run on my PC (add Delphi, C++ Builder and maybe C# or even VB) as possibilities (sorry & no offence intended; I know that it is well suited for string processing, but I don't know PERL and don't rally have time to learn).
Edit: I'm think of some common code which allows to define "triggers" and register callback functions. So, a trigger might say that sender = XXX, title contains, To address is, etc (or combinations thereof) and I can register a callback function which I code which will do the appropriate processing when the condition(s) is met.
Edit: found on SourceForge "ETODB is a free PHP class which allows to parse and extract data from emails to integrate with other php applications. You can automatically parse email messages and convert email to database records, save attachments to specific folders, browse log." http://sourceforge.net/projects/etodb/
Here's a quickly cobbled together script I was using for processing attachments of a special email account:
(some steps and code redacted, for example parts that remember already processed messages and remove messages from the server after a number of days)
Hope this serves as a starting point for you. Unless you can provide a more specific purpose of what you're looking for, it's probably just easy to come up with a script yourself.
The imap lib comes as standard with PHP - rolling your own code around this is trivial.
However polling the email is a very inneficient way to solve the problem - a far better approach is to route the email (or a copy thereof) direct to your script - but you don't say what Operating system you are running on nor which MTA your are using. Assuming it all sits on a Unix box running sendmail or similar, most local delivery agents allow ~/.forward to reference a script. My personal preference is for procmail (which is efectively a programming language for delivery mail, making copies, auto-responses etc).