I'd like to do similar things, and was wondering if there's a fairly complete tutorial anywhere in LP about doing things with incoming mail. Are there easy (or at least, possible) and well documented ways to
- trigger a script to run when email arrives at a particular mailbox (not wait for a cron job)
- let that script read the headers and content of the email
- take some action, such as sending out an email or updating a database
- leave the email alone, delete it, edit (replace) it, or move it to another mailbox
I know that bits and pieces of this have been done many times (autoresponders, SpamAssassin, forwarding), but is there a general framework? Are there toolkits with individual tools to do these various subfunctions that I can mix and match? For example, to look at an email, autorespond in different ways based on senders and keywords, possibly delete some emails or move others to other mailboxes, send an alert email to me in certain cases? This may or may not be amenable to being done with a chain (pipeline) of filters of some kind -- it may need to be under the control of one script so that the control flow can skip around.