Posts Tagged ‘Outlook’

FogBugz – Email edge detection

A while ago I was involved in a project at Clyral where we developed a web based support ticketing system (similar to Zendesk). One of the things we focused on was dealing with the detection of new content in an email conversation. Typically, emails would bounce back and forth between a customer and an agent and we wanted to ensure that our web interface wasn’t cluttered with the full email thread for every reply the customer sent in (the original conversation was always included in outbound emails for convenience).

When we looked at implementing the mechanism which would only extract new content from an inbound email, we found it surprising that there was no real standard for demarcating the beginning/end of an email in an email conversation. It seemed obvious that it would be useful for email clients to stick to a common standard in terms of how they would format existing content when replying to an email, if only to be able to separate the conversation view when viewing an email after a number of exchanges. Off the top of my head, both Outlook and Gmail support this functionality. If you use one of the newer versions of Microsoft Outlook, you’ll notice that the client is capable of detecting the boundaries between emails (take a peak at the screenshot below). The Gmail web client also provides a mechanism to collapse an email conversation into a logical group of messages by detecting new content in an email conversation.


While there didn’t seem to be a standard way of achieving this, we managed to get a decent solution in place for our ticketing system. Since we had control over the format of the outbound email, we could standardise the email format such that we could easily detect new content when a customer responded. This was not a full proof solution, so in the end, we implemented a relatively simple heuristic method that could deal with most of the common mail clients out there. Implementing this feature made it far easier to manage conversations with customers. Obviously, we always kept the original email as customers would sometimes reply with changes to the original email content (such as answering questions inline).

Last year, we started using FogBugz as our general case and project management system. What we discovered was that FogBugz isn’t that smart at managing email conversations. Outbound emails do not include the full email conversation and if you don’t use the web interface to respond, the boundary between the new content and previous communication isn’t detected at all. This usually leads to a very cluttered case view where you need to scroll over copious amounts of duplicate text.

Thankfully, FogBugz has a nifty feature which allows you to customise the front end with JavaScript and CSS.  To deal with this problem, I implemented a very simple JavaScript customisation which scans over the content in a case and hides any email text which is superfluous. You always have the capability to toggle the content if you need to inspect it. I’ve included the code for the customisation below. We use Microsoft Outlook (and most of our clients do as well), so the solution works well for us. Replies from Gmail should be supported as well. The code simply scans email for a new line starting with ‘From: ..’ and splits the email there. It’s not rocket science.

    $('.emailBody').each(function(index, element){
        var body = $(element);
        var edgeIndex = body.html().indexOf('\nFrom: ');
        if (edgeIndex == -1){
        var mainBody = body.html().substring(0, edgeIndex);
        var quotedBody = body.html().substring(edgeIndex);
<div class="showQuote" style="padding-top: 5px;"><a class="dotted" onclick="$(this).parent().parent().find(\'.emailThreadBody\').toggle();" href="javascript:void(0);">- show quoted text -</a></div>
<div class="emailThreadBody" style="display: none;"></div>

Outlook plugin to enhance FogBugz email notifications

We’ve recently started using FogBugz to track the work we do. It’s early days, but we’re hoping FogBugz’s Evidence Based Scheduling (EBS) feature will be able assist us to schedule our sprints better. One thing I found particularly annoying when we first started using the product is that there is no easy way to customise the email notifications you receive. I believe it is possible to update the template when using the self hosted option but that requires fiddling with their code. This is the typical notification one receives if someone edits a case that’s assigned to you (or in the case someone notifies you of a change to a case you are potentially not assigned to):


The notification has all the information you need, however, it’s pretty hard to pick up the message someone may have included. I’m not a fan of plain text emails. When you start receiving a number of these notifications every day, it gets a bit annoying trying to scroll and find the meat of the notification. On Saturday I spent a few hours developing a plugin for Outlook 2010 that could assist with the issue. While this was not my only option (I could have developed a FogBugz plugin), I was intrigued to see if it was indeed possible to update the format of a message in Outlook. As it turns out it’s pretty easy.

This is the result:


I’m no designer (and Outlook’s HTML support is crap) but I’m relatively happy with what I was able to achieve in a short time frame. The plugin will update the email’s format as you open the email so basically, you never have to deal with the plain text version outlined in the first screenshot. Obviously, the downside to this approach is that notifications received on your phone won’t render in the format above (unless you are using Exchange or similar and have opened the email at least once in Outlook).

Other features I was able to add relatively easily included setting the priority flag on the email depending on the priority of the case. If the case is really urgent (priority 1 or 2), the priority flag is set appropriately.


If for some reason the parsing fails, the default email format is kept.

I’ve included the source code as an attachment of this post. Feel free to customise it for your needs. It should be relatively easy to update the template as it is bound to a model which is instantiated as a result of parsing the plain text email.

Hope this is useful.