Lorixen.
EN

Turning inbound emails into records your app can use

Short answer: Inbound email parsing lets your app receive emails, such as orders from a supplier, enquiries from a booking site or replies from customers, as structured data instead of messages someone copies by hand. Point a dedicated subdomain's MX record at an email service with inbound parsing, have it post each message to a webhook in your app, verify the request, then extract the fields you need and save them as records. Start with senders whose emails follow a fixed format, and route anything unexpected to a person.

Where this saves real time

Plenty of small businesses still re-type information that arrives by email:

  • Booking platforms and marketplaces that send a notification email for each new booking or order.
  • Suppliers emailing delivery confirmations or price updates.
  • Website forms that only send an email rather than storing the submission.
  • Customers replying to a quote or support message.

If the email arrives in a predictable format, software can read it. Even when it doesn't, capturing the email against the right customer or job record saves someone searching an inbox later.

How inbound parsing works

Several transactional email services offer inbound processing. The general shape is the same:

  1. You choose an address on a subdomain, such as orders@in.yourshop.co.nz, so your normal mailboxes aren't affected.
  2. You point that subdomain's MX record at the email service. SendGrid's Inbound Parse setup guide, for example, starts with creating the MX record before setting the destination webhook URL.
  3. The service receives each email and turns it into a web request to your app, with the sender, subject, text and HTML bodies, headers and attachments as fields.
  4. Your app processes it and responds with success so the service doesn't retry.

Mailgun, Postmark and others offer similar features under names like routes or inbound webhooks. Compare their current limits and pricing for your expected volume.

Use what the service already parses

Inbound services do some useful work before your code sees the message:

  • Reply text without quoted history. Postmark's inbound documentation describes a StrippedTextReply field containing just the new text of a reply. Mailgun's describes stripped-text fields with the message minus quoted parts and signature block, where it can detect them, with a note that this is best effort.
  • Plus-address tags. Postmark splits anything after a + in the recipient address, as in orders+job4821@…, into a MailboxHash field. That's a simple way to link a reply to a specific record: send outgoing emails with a reply-to that includes the record ID.
  • Attachments arrive as separate items with file names and content types.

Lean on these features rather than writing your own email parser.

Verify that requests are genuine

Your webhook URL is public, so anyone could post fake "emails" to it. Protect it:

  • Check the service's signature on each request. Mailgun, for instance, includes a timestamp and an HMAC signature you verify with your signing key.
  • Use HTTPS and a URL that isn't trivially guessable.
  • Reject requests that fail checks, and log them.

Also remember that the "From" address in an email is easy to fake. Don't let an email alone trigger something sensitive, such as a refund or an account change, based purely on who it claims to be from.

Extracting fields from structured emails

For emails from a system, such as booking notifications, the body usually follows a template. A careful approach:

  1. Collect real examples from each sender, including edge cases like cancellations and amendments.
  2. Write a parser per sender, matching labels like "Booking reference:" and "Arrival date:" rather than fixed line numbers.
  3. Validate the result: required fields present, dates valid, amounts in range.
  4. Save the original email alongside the parsed record, so anyone can check what arrived.
  5. Send anything that doesn't parse cleanly to a review queue, never silently discard it.

If a sender offers an API or a webhook of its own, prefer that. Email parsing is the fallback when no better integration exists.

Tell people what happened

Close the loop for whoever sent the email or relies on it. A short automatic acknowledgement to a customer reply, a note in the record showing "received by email at 10:42", or a daily summary of anything waiting in the review queue all help staff trust the automation instead of double-checking the inbox.

Respond quickly, process in the background

Like other webhooks, inbound email requests should be acknowledged fast. Save the payload, return success and handle parsing in a background job. That avoids timeouts and duplicate deliveries when parsing is slow or attachments are large. Make processing idempotent, using the message ID header to skip duplicates.

Handle attachments safely

Attachments may be invoices, photos or documents you need, but they're also a common route for malware:

  • Store them in object storage, not on the web server.
  • Accept only the file types you expect.
  • Scan them if your setup allows.
  • Never open or execute them on the server beyond what processing needs.

Size limits apply too. SendGrid's guide, for example, advises limiting total message size including attachments to 30 MB to aid delivery, and other providers have their own limits.

A worked example

Picture a hypothetical Queenstown kayak-tour operator taking bookings through two booking platforms that each sent a notification email. Staff re-typed every booking into the operator's own scheduling app. The developer set up an inbound address on a subdomain, forwarded the platform emails to it, verified the webhook signatures, wrote a parser for each platform's template and sent unparseable emails to a review list in the app. Bookings now appear in the schedule within a minute, and staff only handle the occasional odd email.

FAQ

Can I use my normal email address?

It's safer to use a separate subdomain, so changing MX records doesn't affect everyday email. Forward the relevant emails to it.

What if the sender changes their email layout?

Your parser will fail on the new layout. That's why the review queue and alerting on parse failures matter.

Is this suitable for customer support email?

Yes, for linking replies to tickets or records. Full help desk tools may be better for large volumes.

If your team re-types information from emails into your systems, tell us which emails and we'll suggest an approach.

Sources

WhatsAppBook a call