Skip to main content
Lettr allows you to receive and process incoming emails programmatically. By configuring an inbound domain and setting up webhooks, 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)
  • Email Forwarding - Receive, process, and forward emails with transformations
  • 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 parses each email into structured data and delivers it to your application via webhook.
1

Configure Inbound Domain

Add an inbound domain in your Lettr dashboard and configure MX records to route incoming emails to Lettr’s mail servers.
2

Set Up Webhook

Create a webhook endpoint in your application to receive parsed email data when emails arrive.
3

Receive and Process

When someone sends an email to your inbound domain, Lettr parses it and sends the structured data to your webhook.
4

Build Your Logic

Route emails, extract data, trigger workflows, and respond programmatically.
Lettr handles the low-level SMTP reception, MIME parsing, attachment extraction, and spam scoring. Your application receives clean, structured JSON with the email’s sender, recipients, subject, body (both plain text and HTML), headers, and attachment URLs.

Quick Start

1. Add an Inbound Domain

Navigate to DomainsInbound in your dashboard, click Add Domain, and enter your domain (e.g., mail.example.com).
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

Set up a webhook endpoint to receive parsed emails:
Always verify webhook credentials before processing incoming emails to ensure requests are genuinely from Lettr. Configure Basic Auth or OAuth 2.0 authentication when creating your webhook in the dashboard.

Webhook Payload

When an email is received, Lettr sends a relay.relay_delivery webhook event. The payload is delivered as a JSON array of event objects, each containing a relay message with the parsed email:
Lettr automatically handles MIME parsing and delivers both the structured content fields and the raw RFC 822 message. For a complete breakdown of each field and how to work with them, see Email Parsing.

Key Capabilities

Email Routing

Route incoming emails to different handlers based on recipient, content, or custom 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

Every email includes a spam score, and you can configure automatic filtering:
You can also configure spam filtering sensitivity for your inbound domain through the dashboard under DomainsInbound. Regardless of dashboard settings, you can implement your own filtering logic in your webhook handler. See Spam Filtering for advanced detection patterns and allowlist/blocklist management.

Attachment Handling

Attachments are automatically extracted and made available via secure URLs:
Attachment URLs expire after 24 hours. Download and store attachments promptly if you need them longer.
Each attachment includes filename, contentType, size (in bytes), and a download url. See Attachments for storage examples (S3, GCS) and security best practices including file type verification 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 200 status from your webhook endpoint within a few seconds. If processing is complex, accept the webhook and process asynchronously via a queue.
  • Handle duplicates — Webhooks may be delivered more than once. Use the event id to deduplicate.
  • Store before processing — Save the raw webhook payload before doing any processing, so you can replay events if something fails.
  • Validate attachments — Verify file types and scan for malware before processing attachments from unknown senders.
See Best Practices for architecture patterns, reliability strategies, and monitoring recommendations.

Learn More

Setup Guide

Step-by-step domain and webhook configuration

Webhooks

Webhook configuration and event handling

Routing

Route emails to different handlers

Attachments

Handle incoming file attachments

Spam Filtering

Filter and manage spam

Reply Tracking

Track and thread email replies

Email Parsing

Understanding parsed email data

Security

Secure your inbound processing

Best Practices

Build reliable email processing

Inbound Domains

Domain configuration details

Webhooks Overview

General webhook documentation