Email Content Analysis: An Inbound Parse Sample Application – Part 1
Back in April we launched our Inbound Parsing feature, and a few weeks ago we outlined the top 3 uses of this service. In this two-part post we want to present a short sample application that demonstrates how easy it is to get some interesting results with Inbound Parsing.
Let’s pretend for a moment we own a small hand- and power-tool distribution company, and we want to store and analyze all email coming into our @sales.mytoolcompany.com domain. For simplicity’s sake, let’s say we have two requirements:
- Save all these emails into a database for easy retrieval and management
- Get some quick stats on these emails as they’re coming in
The former would allow rich, full-fledged querying and analysis over the entire domain’s email history for a variety of business needs. The latter might look like the widget below: a real-time-updated chart of the top-occurring keywords in our sales inquiry emails.
Setting up Inbound Parsing for such an application is a simple 3-step process:
- Create an HTTP/S endpoint to receive the parsed email messages. This is a simple website that a) receives the POST requests containing the JSON-formatted, parsed email that was sent to your domain, b) returns your SocketLabs server’s Inbound Parse Validation Code (so we know we’re sending it to the right place), and c) does something useful with the data. (We’ll go into detail into setting up such an endpoint in next week’s blog post.)
- Set your email domain’s MX record to point to [ mx.socketlabs.com ]. The “MX record” of your domain tells email servers where to deliver your messages. In this case, we want to forward them to SocketLabs for parsing and re-delivery. A couple things to note about altering MX records: all emails sent to the domain set up for inbound parsing will get processed by the SocketLabs inbound email service – so you’ll likely only want to use a subdomain in this setup. Also, it’s best to have mx.socketlabs.com be the only server on the MX record.
- Turn on the Inbound Parsing feature in your SocketLabs server’s settings. To do so, open the Reports menu in the SocketLab’s Control Panel and then click on the Configure Inbound Parsing link. Now select “Enabled” from the drop-down menu. Make sure your endpoint from (1) above is returning the validation code shown and type its URL into the field. Add the domain you wish to have parsed to the list at the bottom and click “Update” and you’ll be ready to start reaping the benefits of parsed and POSTed emails from SocketLabs.
(Keep an eye out for Part 2 of this post – we’ll go into more detail on the endpoint setup itself.)