Open Discussion → send history emails

send history emails


I would like to configure POPFile to send me an email with the same information that is displayed in the history tab. These regular emails would firstly reduce the need to visit the webinterface and secondly they would provide me with a quick overview of what has been sorted into various folders (so that I also don't have to visit those folders so often).

Anyway: I'm guessing that this should not be a big deal to implement since the most of the code needed for such a module already exists (and is used to produce the history page). Although I don't know perl at all, I read my way through the code of some of the modules, hoping that I might perhaps be able to put this together in an improvised way, but I found that it would take me far too much time to figure out the perl basics that I'd nevertheless need. So here I come, asking if any perl programmer would like to help with this?

To get you started, here is what I figured out so far (please correct me, if I'm wrong):

- The subroutines for querying the history (which is stored in a database) is in, starting at line 877. This seems to be the interface we need to create the content of the email.

So I was thinking like this:
- We need a script that can be triggered at a set time interval (e.g. once per day).

- That script would query the history and write a simple text file in which one line contains the basic information from one email (from, subject date, bucket, or so), perhaps a plank line in between each record.

- Of course, this basic setup could be improved a lot (e.g. I would like to create separate emails for each bucket, or creating a simple html file instead of a pure text file might be nice), but I'm keeping it simple here, in order to increase chances of getting this done. Tweaks and improvements later.

- Once those files are created, there are at least two options to proceed. On a linux system, it should be pretty easy to create a cron job that emails those files at regular intervals. But I'd prefer to keep this compatible with all platforms so it should be done in perl.

- This should not be a big deal, since sending emails is part of what POPFile is designed for, right? (Although I've never used that function since I'm using the IMAP module).

Anyway, this is as far as I got so far.

Any help and hints appreciated.