A Small Scratch for a Small Itch: How Long Would It Take to Develop This Software Myself?

As a developer, sometimes (though not very often) we encounter requirements that cannot be fulfilled by any application we know. This poses quite a challenge. On one hand, you’d like to find some piece of software that’s already developed, that’s open source and that’s been working in a tried-and-tested way for quite awhile. On the other hand, it’s highly inefficient to spend a whole work day searching for some perfectly-awesome app that’s going to provide the end-all, be-all solution. The cost-benefit analysis is as follows: How long would it take to develop this software myself? Any other equation means you’re doing it wrong.1

In the case of my work, ezeep has a Django backend that is using an email gateway, which is nothing new and pretty standard. But we have different environments—say, production and testing—which are a bit different. In the production environment, the emails are sent using an external email gateway. On testing, although we have dummy data (fake e-mail addresses), we don’t want the emails to go to the gateway, so they end up in a file.

The ‘gotcha’ here is that we also need to check these emails during our testing process, and I don’t want my colleagues to ssh the server and check that file out. Besides, have you seen how emails look like when they are in a file (which is the standard format)? It looks a little something like this:

Content-Type: multipart/alternative;
boundary="===============2000696633744152727=="
MIME-Version: 1.0
Subject: Welcome to ezeep
From: ezeep <help@ezeep.com>
To: 9490182394@ezeep.com
Date: Mon, 29 Jul 2013 10:28:58 -0000
Message-ID: <20130729102858.10018.85421@cb482df.dev.ezeep.com>--===============2000696633744152727==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 8bitHey,Thanks for confirming your account--we’re delighted to have you aboardNow that you’re all set, why not try printing from our ezeep mobile apps? Yes, you can now print directly from your phone--pretty unbelievable, huh?)Get ezeep for iPhone, iPad and iPod Touch
https://itunes.apple.com/app/ezeep/id493953434Get ezeep for Android
https://play.google.com/store/apps/details?id=com.ezeep.printWe love hearing from you. If you have feedback or questions, you tell us hi on Facebook, Twitter, or help@ezeep.com.http://www.facebook.com/ezeeplive
https://twitter.com/ezeepwith ♥ from the ezeep teamezeep.com

Pretty ugly, right? We can’t even see roughly if the html is rendered correctly. But don’t lose focus! What are our requirements?

I want to be able to check emails—including who sent it, to whom, when and, of course, the content.
That’s all. I would be happy with something like that. Just a web that shows a list of emails that I can click in order to get the details and the content. Again, that’s all I need.

Oh, the development effort.

Usually we use Django, ‘the awesome web framework,’ for this kind of development—but the size of this project makes its election an overkill. So for this task, something like Flask would be faster to build on top of.

So the list of ingredients for this tasty cake include:

Flask, as we said, will provide the web framework.

  • Email parsing, taken from the Python standard library, to read the file with the emails
  • Logic to extract the data and metadata, the contents of the email and the subject, sender…
  • Templates to show the information on a browser in a structured way
  • Javascript to avoid reload pages and make the overall user experience a bit better.

In the end, it took me something like two hours to put all the parts together. It’s just a patch, a small scratch for a small itch. Don’t look at it in terms of functionality, but more like a small effort that makes my colleagues’ live easier.

Wanna check out my code? You can find it here: https://github.com/ezeep/email-visualization

All comments are, obviously, more than welcome.

1 Disclaimer: I’m not the kind of person that likes to re-invent the wheel, to write another editor or the n-th app for video store management. I prefer to reuse, to integrate already developed pieces of software into something bigger. I think it is clear for most that this is the way to go, that reusing that is already there, that has been tested and that is maintained is simple easier than building something from scratch. If you need an app for one of your itches, try to find if it exists first. If you find it but doesn’t cover your expectations maybe you can adapt it to your needs and if you do this, please, contribute with the changes back, it may help to people like you.