Hi I’m Kunal, I am a new Developer Evangelist at SendGrid. I want to introduce you to my first SendGrid hack, the OCR App. However, before I tell you more about my hack I want to give you a little insight behind my motivation. I wanted to create something that showcased the simplicity and power of our APIs. I also wanted it to be something that people could use after hearing about it. I thought it would be interesting to do a mashup between our SMTP & Inbound Parse APIs as well as Abbyy’s OCR SDK.

What does this hack do?

A user just takes a picture of any printed text and emails that to my address, they then get an editable text document as a reply. This hack is live, so go ahead and try it yourself.

  1. Take out your phone and take a photo of some printed text. You can see below that I took a photo of a nutrition label.
  2. Send an email to ocrthat@si.ht with the image attached. (If you can, try to send the image so it’s less than 1mb)
  3. Make sure to include a subject! I use this to name the document that gets sent back.
  4. You will get back an email within a couple of minutes with an .rtf file attached. You can open that up in your editor and see that the image you sent is now an editable file!

That’s what it looks like to a user. Here’s the hacker’s view of things.

Behind the Scenes

This app takes advantage of our Inbound Parse API, which is actually a webhook. This means that whenever an email is sent to my domain — www.si.ht — SendGrid first parses the email into its components and posts them to a url of my choice. My application then gets those individual pieces and performs some logic.

In this case, my app gets your email, subject and image. It then converts that image to an rtf file using Abbyy’s OCR SDK and then uses our SMTP API to send you back a reply email with the attached document.


The entire app, written in PHP, is up on Github. Check out the core piece of the hack below.

If you want to get started and create your own SendGrid application that takes advantage of our Inbound Parse API, create an account on SendGrid.com and follow the instructions on our awesome documentation.

SendGrid Team
Expert advice and insight about all things email including best practices tips, examples, and advice for marketers, developers, and everyone in between.