Skip to main content
LMTP (Local Mail Transfer Protocol) is a variant of SMTP designed for local mail delivery. Unlike SMTP, LMTP returns a separate response for each recipient.

Complete example

lmtp-server.ts

How LMTP differs from SMTP

1

LHLO instead of EHLO

Clients greet the server with LHLO instead of EHLO or HELO.
2

Per-recipient responses

After the DATA phase, the server sends one response line for each RCPT TO command, in the same order.
3

No pipelining

LMTP does not support command pipelining.
4

Local delivery focus

LMTP is designed for local mail delivery, not relaying between domains.

Per-recipient responses

In LMTP mode, the onData callback’s second argument can be an array:
Each element is either:
  • A string for success (generates a 250 response)
  • An SMTPError object with a responseCode property
The array must have exactly one entry per recipient in session.envelope.rcptTo, in the same order.

Creating error responses

Helper function to create typed errors:

LMTP response codes

Common LMTP response codes:

Example LMTP dialogue

Here’s what a complete LMTP session looks like:
Notice three separate responses after DATA, one per recipient.

Testing the LMTP server

Create test mailboxes:
Connect with telnet:
Send a message to multiple recipients:
You should see:

Validating recipients early

You can still reject recipients during the RCPT TO phase if you want to avoid partial delivery:
If you do this, the client will never send DATA for invalid recipients.
However, some LMTP use cases prefer to accept all recipients during RCPT TO and return per-recipient errors during DATA. This allows logging all attempted recipients.

Use cases for LMTP

LMTP is commonly used for:
  • Mail delivery agents (MDAs): Delivering mail to local mailboxes
  • Mailing list servers: Expanding a single message to multiple recipients
  • Spam filters: Per-recipient filtering decisions
  • Local mail routing: Between components in a mail system
LMTP is typically used on Unix domain sockets or localhost, not exposed to the internet. For internet-facing servers, use SMTP.

Next steps

Callbacks reference

Learn about onData and per-recipient responses

Configuration

Explore all LMTP configuration options

Basic server

Start with a basic SMTP server

Session object

Understand the session envelope