Out Of Office Engine

Over Christmas (among other things) I’ve been messing around writing a little app to handle Out Of Office notifications for my Dad’s business.

Beaches and Blenders

Dad’s mail server runs Postfix on Linux and while there are a number of options to set up auto response messages, such as the vacation application. This seams to work well, but requires the user to edit files on the server to make it work. I wanted something a little bit more user friendly as none of the userbase for this tool have any idea what a Linux command line looks like.

I’ve finally started to move all my little side project from Java to NodeJS so I set out by crawling through npmjs to see which nodes I could use to help.

I started out with mailparser to be able to read and pull out the useful stuff from the original mail like the headers and any attachments.

Next up came email-templates to allow me to built a standard reply template then slot in a per user specific message. This was paired with nodemailer to actually send the response.

That was it for the bit that actually read and replied to the mail, but I needed user interface so I opted for a simple express web server using ejs to template the data.

Out Of Office Editor

All this is tied together with a small Mongodb to hold the details of each Out Of Office period and the list of email addresses that have been replied to. Mongodb is probably overkill for this but it’s simple to setup. It holds a record like this one for each user:

{
   "_id" : ObjectId("54a7d6f4176a69088a22b4b5"), 
  "name" : "b.hardill", 
  "startDate" : "2015-01-02T12:29:57.238Z", 
  "endDate" : "2015-01-30T21:59:17.971Z", 
  "subject" : "Away", 
  "message" : "I'll be out of the office for the next week, I'll get back to you when I get back", 
  "list" : [
    "bob@example.com", 
    "jim@example.com" 
  ]
}

I’ve stuck the project up on github here

It probably still needs some more testing but it should be good enough for what my Dad needs.

If I end up feeling really adventurous I may even try and remember hot to write a Thunderbird plugin to enable/disable things and set the dates.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.