JSON Over Mailto

First thing first, don’t take the solution in this post serious.

I was working on a project where we want to make our web-based application perform some actions in Microsoft Outlook. It’s not a common behaviour but it is probably workable in a very controlled place like my firm, where almost all the users having same set of applications.

Due to browser sandbox security, communication between web app and host application is not straight-forward. So my initial thinking is to use some JavaScript interact with ActiveX (only IE can use in this case) then further perform actions from Outlook with a Outlook add-in.

My architect is a genius, he suddenly suggested why not use mailto link, since all the users will use Outlook as their only E-mail tool.

I have to say before I started to work on it I felt it very hardly work. But after a few hours trying I found out it’s actually possible to let Outlook add-in to capture the special mailto and do some funny actions after that. The only problem I have is that if user’s Outlook is not opened first, then he will see a new mail window with special mailto address in. This is because Outlook start new mail window first and only load add-in after that.

MSDN has a good tutorial on Outlook plugin here.

So next thing is how to pass data in Outlook, and since I’m familiar with Web application and always work on web, JSON just comes to my mind. So in the end I embedded JSON string in mailto URL and created a new pattern which my colleague called “JSON-over-mailto”.

It’s a really fun experience to do such unusual practice, and also┬árealize┬áthat Microsoft tools are really powerful.

Last thing, this is not a common practice and only work in a special close environment. But if you want to have something fun, just go ahead and try.