E-mail Herald

E-mail Herald is my attempt at reducing the amount of time I hunt for information I need every morning. E-mail Herald is an extensible and tiny framework for creating digest e-mails (heralds) that can be sent out once a day. The difference between this framework and the myriad of other daily digest e-mailing services is that it is meant to be customized and extended. It is up to you to specify what information you want to receive and when. You get to control the formatting, the length, etc. My goal in creating this framework was to make the e-mails it generates as small as possible.

How it works

Currently to deploy E-mail Herald you need to have a server capable of running PHP5 (web server is not required at this point). All of the configuration is done by editing two files: config.php and LocalUser.php. The first file lets you set some simple options such as who you want the heralds to be e-mailed as and whether you want to run in local mode only (meaning instead of e-mailing, the herald is printed to stdout).

The second file, LocalUser.php, lets you specify which plugins you want to use. The plugins are located in the plugins/ directory and currently there are four of them: a Weather plugin (the first one!), the Woot deal of the day plugin, the Google Calendar plugin (using Morten Fangal's excellent iCal parser), and a Cron plugin.

Cron plugin

While the first three plugins are fairly straightforward I should explain the Cron plugin. I am responsible for a half dozen cron jobs that run every night and I need to know whether they ran successfully. Typically at the end of the job, each script e-mails me the summary of what was done which generates a half a dozen e-mail. To avoid this I created this plugin and set up some funky forwarding rules. Here are my steps to success:

  1. Set all your cron jobs to e-mail you with the Subject of Cron: success (job:subjob) (substitute "error" for "success" when appropriate). The body of the e-mail should contain a short summary of the success or a long, verbose explanation of the error.
  2. Set up a special e-mail account for these cron jobs. Make sure this account has IMAP access.
  3. Forward all mail that starts with Cron: to that e-mail account. I suggest you also archive a local copy just in case.
  4. Tell the Cron plugin to check the e-mail account's inbox: simply put the login info into the LocalUser.php
  5. ...
  6. Profit! Now you only get a single herald containing the summary of all the cron jobs that ran while you were sleeping.

What's Next

The way I built E-mail Herald is to allow for further customization. I could develop a web front-end interface for editing user settings and even allow multi-user functionality (since LocalUser simply extends User which can come from say a database/datastore). However, the existing functionality is already enough for me. If you are interested in this functionality, feel free to do so: E-mail Herald is open source.

Get E-mail Herald

svn co https://email-herald.svn.sourceforge.net/svnroot/email-herald/trunk email-herald