Hello,
At 2025-06-19 14:58, Uolys wrote:
Do any of you have some experience of LMTP on the same localhost? How
to teach MTA to communicate with MDA? Sorry, I could not find an
appropriate guide nor examples online.
Vladas Palubinskas (a.k.a. Uolys)
I’m in the process of writing a blog article for my OpenSMTPD+Dovecot
setup on Linux, which uses LMTP with Dovecot virtual users on a single host.
I haven’t found time to continue yet, but I can send the OpenSMTPD LMTP
configuration part from my current draft if it helps.
The configuration from the OpenSMTPD side is as follows:
# Used for email aliases
table virtualiasfile:/etc/smtpd/virtual-aliases
[…]
action "dovecot_lmtp" lmtp "/var/run/dovecot/lmtp" rcpt-to virtual
<virtualias>
match for domain "example.com" from any action "dovecot_lmtp"
rcpt-to after lmtp makes OpenSMTPD send the mail to the address, instead
of the user (as we will only use one user).
We can create a dedicated lmtp-delivery user to perform LMTP deliveries
and restrict access to other users:
useradd -d /var/empty -MN lmtp-delivery. OpenSMTPD will check whether a
~/.forward file exists for the delivery user, so its home directory
cannot be set to /dev/null. Another option is to use nobody and the
default dovecot configuration of the LMTP socket being accessible to all
users (mode = 0666).
The aliases file uses the format described in man 5 aliases. In this
case, if we have the email addres...@example.com and we want to add
r...@example.com as an alias to it, we could use the following file:
r...@example.com m...@example.com
m...@example.com lmtp-delivery
Here, we use lmtp-delivery as the delivery user, so we alias the
"real" email addresses (associated with a virtual user) to it.
Another valid option would be to add user lmtp-delivery in the
smtpd.conf action line, and omit the aliases to lmtp-delivery,
though I have not tested this configuration.