Skip to main content
Lettr allows you to receive and process incoming emails programmatically. By configuring an inbound domain with a forwarding URL, your application can capture replies to transactional emails, process support requests, parse incoming data, and trigger automated workflows whenever an email arrives.

What You Can Build

  • Support Ticket Systems - Automatically create tickets from customer emails
  • Reply Tracking - Capture replies to your transactional emails and thread conversations
  • Email-to-Action Workflows - Trigger processes when specific emails arrive
  • Data Extraction - Parse structured data from incoming emails (orders, receipts, notifications)
  • Per-User Addresses - Give each user, record, or workflow its own address, since mail to any address at the domain is forwarded
  • Unsubscribe Processing - Handle unsubscribe requests via email

How It Works

Lettr’s inbound email processing follows a four-step flow. You configure DNS to route emails to Lettr’s mail servers, and Lettr posts each email to your application’s forwarding URL as JSON.
1

Build a Receiving Endpoint

Create an endpoint in your application that accepts POST requests and returns a 2xx status. This is your forwarding URL.
2

Configure Inbound Domain

Add an inbound domain in your Lettr dashboard with your forwarding URL, then configure MX records to route incoming emails to Lettr’s mail servers.
3

Receive and Process

When someone sends an email to any address on your inbound domain, Lettr posts it to your forwarding URL as JSON.
4

Build Your Logic

Route emails, extract data, trigger workflows, and respond programmatically.
Lettr’s inbound servers handle SMTP reception and post each message to your forwarding URL. Your application receives JSON with the email’s sender, recipients, subject, body (plain text and HTML, when present), headers, and the complete raw MIME message. Attachments and inline images are only available inside that raw message. Lettr doesn’t score, filter, or store the messages it forwards: anything beyond delivery, such as spam checks, routing, or saving attachments, happens in your handler.

Quick Start

1. Add an Inbound Domain

Navigate to Domains → Inbound in your dashboard and click Create Inbound Domain. Enter your domain (e.g., mail.example.com), a Forwarding URL for your endpoint (e.g., https://yourapp.com/webhooks/inbound), and optionally an Auth token. The forwarding URL is required and is tested with a POST request before the domain is created. If your endpoint doesn’t answer with a 2xx status, the dashboard shows the status it returned and the domain is not created. See the Setup Guide for what to do when a firewall blocks the test.
Inbound domain management is available through the Lettr dashboard. There is no public API endpoint for creating or managing inbound domains.

2. Configure DNS

Add the provided MX records to your domain: Multiple MX records with equal priority provide load balancing: sending servers distribute email across all three servers. If one is unavailable, the others handle delivery. See the Setup Guide for DNS propagation details.

3. Handle Incoming Emails

Handle incoming emails at your forwarding URL:
Always verify the auth token before processing incoming emails to ensure requests are genuinely from Lettr. Set the token in the Auth token field when you create the inbound domain, or later on the domain’s Mail Forwarding card. Lettr sends it in the X-MessageSystems-Webhook-Token header.

Webhook Payload

When an email is received, Lettr posts it to your domain’s forwarding URL. The payload is a JSON array of event objects (one request can carry more than one email), each containing an msys.relay_message:
The payload was produced by SparkPost, the mail infrastructure behind Lettr’s inbound servers. Alongside the convenience fields (subject, text, html, headers), email_rfc822 holds the complete raw message, base64-encoded when email_rfc822_is_base64 is true. Either text or html can be missing, so handle both cases. There is no attachments array, spam score, or event ID in the payload. For a complete breakdown of each field, see Email Parsing.

Key Capabilities

Email Routing

Mail sent to any address at your inbound domain is forwarded to the same URL, so routing happens in your handler. Route incoming emails based on recipient, content, or your own rules:
The reply+ pattern above is called variable addressing (or plus addressing). It’s a common way to encode context in the recipient address so you can route replies back to the right record. See Routing for more patterns including routing by subject, sender domain, and content.

Spam Filtering

Lettr adds no spam score and doesn’t filter, quarantine, or drop inbound mail for you. Every message that reaches your inbound domain is forwarded. If you want spam handling, implement it in your handler, for example by checking authentication results when the receiving server added them, the sender’s domain, or a third-party filter:
See Spam Filtering for more patterns you can build in your handler.

Attachment Handling

Attachments aren’t sent as separate fields or URLs. They are inside the raw MIME message in content.email_rfc822, so parse it with a MIME library such as mailparser for Node.js:
Lettr doesn’t store inbound messages or their attachments, so the payload is your only copy. Save what you need when the request arrives. See Attachments for storage examples and security practices such as file type checks and malware scanning.

Reply Tracking

Track replies to your transactional emails by using variable reply-to addresses:
For more advanced threading, use email headers like Message-ID, In-Reply-To, and References to build full conversation threads. See Reply Tracking for header-based threading, auto-reply detection, and a complete support ticket example.

Real-World Examples

Support Ticket System

Create support tickets from incoming emails and track the conversation thread:

Email-to-Task Automation

Parse incoming emails to create tasks in your project management system:

Using Subdomains

We recommend using a subdomain for inbound email to keep it separate from your primary email: This lets you keep your root domain’s MX records pointing to your regular email provider while routing specific subdomains through Lettr.

Processing Best Practices

  • Respond quickly: Return a 2xx status as soon as you have the payload, and do slow work asynchronously via a queue.
  • Handle duplicates: The same email can be delivered more than once. The payload has no event ID, so deduplicate on the email’s Message-ID header.
  • Store before processing: Save the raw request body before doing any processing, so you can replay it if something fails. Lettr keeps no copy.
  • Validate attachments: If you extract attachments from email_rfc822, verify file types and scan for malware before using them.
See Best Practices for architecture patterns, reliability strategies, and monitoring recommendations.

Learn More

Setup Guide

Step-by-step domain and forwarding URL configuration

Routing

Route emails to different handlers

Attachments

Get attachments out of the raw MIME message

Spam Filtering

Add your own spam checks in your handler

Reply Tracking

Track and thread email replies

Email Parsing

Every field in the forwarding URL payload

Security

Secure your inbound processing

Best Practices

Build reliable email processing

Inbound Domains

Domain configuration details

Webhooks Overview

Lettr webhooks for event notifications, including relay delivery status

Building a Support Inbox

Turn customer emails into tickets with inbound email.