Email Parser API

Stop wrestling with MIME boundaries, base64 encoding, and charset issues. CloudMailin's email parser handles the complexity and delivers clean, structured JSON.

No regex, no libraries, no headaches - just parsed email data ready to use.

Email parsing API - convert raw email to structured JSON

Raw Email

Return-Path: <from@example.com>
Received: by 10.52.90.229 with SMTP id bz5cs75582vdb;
 Mon, 16 Jan 2012 09:00:07 -0800
Received: by 10.216.131.153 with SMTP id
 m25mr5479776wei.9.1326733205283;
 Mon, 16 Jan 2012 09:00:05 -0800
Received: from mail-wi0-f170.google.com
 (mail-wi0-f170.google.com [209.85.212.170])
 by mx.google.com with ESMTPS id
 u74si9614172weq.62.2012.01.16.09.00.04
 (version=TLSv1/SSLv3 cipher=OTHER);
 Mon, 16 Jan 2012 09:00:04 -0800
Date: Mon, 16 Jan 2012 17:00:01 +0000
From: =?UTF-8?Q?Message_Sender?= <sender@example.com>
To: =?UTF-8?B?TWVzc2FnZSBSZWNpcGllbnQ=?= <to@example.co.uk>
Message-ID: <4F145791.8040802@example.com>
Subject: =?UTF-8?B?VGVzdCBTdWJqZWN0?=
MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary="------------090409040602000601080801"
Delivered-To: to@example.com
Received-SPF: neutral (google.com: 10.0.10.1 is neither
 permitted nor denied by best guess record for domain
 of from@example.com) client-ip=10.0.10.1;
Authentication-Results: mx.google.com; spf=neutral
 (google.com: 10.0.10.1 is neither permitted nor denied
 by best guess record for domain of from@example.com)
 smtp.mail=from@example.com
User-Agent: Postbox 3.0.2 (Macintosh/20111203)

--------------090409040602000601080801
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Test with HTML.
--------------090409040602000601080801
Content-Type: text/html; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable

<html><head>=0A<meta http-equiv=3D"content-type"
content=3D"text/html; charset=3DISO-8859-1"></head>
<body=0A bgcolor=3D"#FFFFFF" text=3D"#000000">=0A
Test with <span style=3D"font-weight: bold;">HTML
</span>.<br>=0A</body>=0A</html>
--------------090409040602000601080801
Content-Type: text/plain; name="file.txt"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="file.txt"

dGVzdGZpbGU=
--------------090409040602000601080801
Content-Type: text/plain; charset="UTF-8"; name="menu.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="menu.txt"

Caf=C3=A9 menu
- Espresso =E2=82=AC3.50
- Latt=C3=A9 =E2=82=AC4.00
--------------090409040602000601080801--

Parsed JSON

// Example Email to HTTP POST in the JSON Format
{
  "headers": {
    "Return-Path": "from@example.com",
    "Received": [
      "by 10.52.90.229 with SMTP id bz5cs75582vdb; Mon, 16 Jan 2012 09:00:07 -0800",
      "by 10.216.131.153 with SMTP id m25mr5479776wei.9.1326733205283; Mon, 16 Jan 2012 09:00:05 -0800",
      "from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by mx.google.com with ESMTPS id u74si9614172weq.62.2012.01.16.09.00.04 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 Jan 2012 09:00:04 -0800"
    ],
    "Date": "Mon, 16 Jan 2012 17:00:01 +0000",
    "From": "Message Sender <sender@example.com>",
    "To": "Message Recipient<to@example.co.uk>",
    "Message-ID": "<4F145791.8040802@example.com>",
    "Subject": "Test Subject",
    "Mime-Version": "1.0",
    "Content-Type": "multipart/alternative; boundary=------------090409040602000601080801",
    "Delivered-To": "to@example.com",
    "Received-SPF": "neutral (google.com: 10.0.10.1 is neither permitted nor denied by best guess record for domain of from@example.com) client-ip=10.0.10.1;",
    "Authentication-Results": "mx.google.com; spf=neutral (google.com: 10.0.10.1 is neither permitted nor denied by best guess record for domain of from@example.com) smtp.mail=from@example.com",
    "User-Agent": "Postbox 3.0.2 (Macintosh/20111203)"
  },
  "envelope": {
    "to": "to@example.com",
    "from": "from@example.com",
    "helo_domain": "localhost",
    "remote_ip": "127.0.0.1",
    "recipients": [
      "to@example.com",
      "another@example.com"
    ],
    "spf": {
      "result": "pass",
      "domain": "example.com"
    }
  },
  "plain": "Test with HTML.",
  "html": "<html><head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\"></head><body\n bgcolor=\"#FFFFFF\" text=\"#000000\">\nTest with <span style=\"font-weight: bold;\">HTML</span>.<br>\n</body>\n</html>",
  "reply_plain": "Message reply if found.",
  "attachments": [
    {
      "content": "dGVzdGZpbGU=",
      "file_name": "file.txt",
      "content_type": "text/plain",
      "size": 8,
      "disposition": "attachment"
    },
    {
      "content": "Q2Fmw6kgbWVudQotIEVzcHJlc3NvIOKCrDMuNTAKLSBMYXR0w6kg4oKsNC4wMA==",
      "file_name": "menu.txt",
      "content_type": "text/plain",
      "size": 42,
      "disposition": "attachment"
    }
  ]
}

Testimonials

Don't just take our word for it

Andreas Santoro

Andreas Santoro

CTO, ExpressSteuer

CloudMailin has been instrumental in our growth at ExpressSteuer. The system is not only incredibly easy to implement, but also highly reliable and robust. What's more, their support team is simply amazing - always quick to respond and provide effective solutions to any challenge we encounter. We couldn't be more pleased with the service provided by CloudMailin!

Dan

Dan

CamelCamelCamel.com

Thanks for the rock solid decade

Francisco (Kiko) R.

Francisco (Kiko) R.

Head of Engineering, ProFinda.com

The product is perfect, feature rich, nice and intuitive UI and great support. It was really easy to integrate it into our application. It enables our application to receive inbound traffic, to give better support to clients and to expand our mailing options.

Start Parsing Emails in Minutes

The first 10,000 emails per month are free. No credit card required.