Era Host hosting
EraHost – Free Domain, Cheap Hosting!
Client Area
Support 24/7
Menu

Understanding dovecot_virtual_delivery in Dovecot

4 min read
03.09.2025

What is dovecot_virtual_delivery?

If you are facing mail delivery issues related to Dovecot's virtual user system, the problem may be with:

dovecot_virtual_delivery Mail
Dovecot side of virtual delivery — LMTP socket + permissions.

For the Postfix-side of the same delivery flow, see Understanding dovecot_virtual_delivery in Dovecot Mail Server (the Postfix angle). For broader mail-stack debugging, "EHLO not accepted from server!" and Fixing t_dkim_invalid (DKIM Signature Issue).

  • Dovecot LDA (Local Delivery Agent) ? Handles local mail delivery to mailboxes
  • Dovecot LMTP (Local Mail Transfer Protocol) ? Modern protocol for efficient virtual mail delivery
  • Virtual Mailbox Configuration ? Incorrect paths or database settings
  • Incorrect Permissions on Mail Directories ? Dovecot can't write to mail storage

Check Dovecot Mail Delivery Method

Dovecot delivers emails in two common ways:

  1. LDA (Local Delivery Agent) > Used when Dovecot handles local mail delivery directly.
  2. LMTP (Local Mail Transfer Protocol) > Used for virtual mail users and integrates better with Postfix; more efficient for high-volume mail servers.

Check which method your system uses:

sudo dovecot -n | grep -i "mail_delivery\|protocol lda\|protocol lmtp"

If using LDA, you might see:

mail_plugins = sieve
protocol lda {
    mail_plugins = $mail_plugins sieve
}

If using LMTP, you might see:

protocol lmtp {
    mail_plugins = quota sieve
}
Modern Recommendation: For virtual user setups (where mail users aren't system users), LMTP is strongly preferred over LDA as it's faster and handles multiple recipients more efficiently.

Verify Dovecot Virtual Mailbox Configuration

If your system uses virtual mail users, make sure Dovecot is properly configured.

Check Dovecot Virtual Mail Setup

Edit the main Dovecot configuration file:

sudo nano /etc/dovecot/conf.d/10-mail.conf

Ensure the following settings are correct for a typical Maildir setup:

mail_location = maildir:/var/mail/vhosts/%d/%n

Where:

  • %d > Domain name (e.g., example.com)
  • %n > Username (e.g., john)
This would create a path like: /var/mail/vhosts/example.com/john

If using a MySQL/PostgreSQL backend for user authentication, also check these typically associated settings:

mail_home = /var/mail/vhosts/%d/%n
mail_location = maildir:/var/mail/vhosts/%d/%n/Maildir

Apply changes and restart Dovecot:

sudo systemctl restart dovecot
Linux VDS
High performance for your projects
  • Root access and flexible setup
  • Control panel
  • NVMe disks
  • DDR5
Linux VDS

Check LMTP Configuration

If using Dovecot LMTP (recommended), ensure it's properly configured to communicate with Postfix.

Edit the master configuration file:

sudo nano /etc/dovecot/conf.d/10-master.conf

Look for a section similar to this (location may vary by distribution):

service lmtp {
    unix_listener /var/spool/postfix/private/dovecot-lmtp {
        mode = 0600
        user = postfix
        group = postfix
    }
}

In Postfix (/etc/postfix/main.cf), ensure mail delivery is delegated to Dovecot's LMTP socket:

mailbox_transport = lmtp:unix:private/dovecot-lmtp
# or for virtual_transport if using virtual domains:
virtual_transport = lmtp:unix:private/dovecot-lmtp

Restart both services:

sudo systemctl restart postfix dovecot

Fix Mail Directory Permissions

The most common virtual delivery failure is incorrect permissions. Dovecot needs to write to the mail storage directory.

1. Ensure the dedicated vmail user exists:

id vmail

If the user doesn't exist, create it:

sudo useradd -r -d /var/mail -m -s /sbin/nologin vmail

2. Set correct ownership on your mail storage directory:

sudo chown -R vmail:vmail /var/mail/vhosts
sudo chmod -R 770 /var/mail/vhosts

3. In Dovecot configuration (/etc/dovecot/conf.d/10-mail.conf), set the user and group:

mail_uid = vmail
mail_gid = vmail

4. Restart Dovecot:

sudo systemctl restart dovecot

Check Mail Logs for Errors

If mail delivery still fails, check system logs for specific error messages.

Check Dovecot service logs:

sudo journalctl -u dovecot --no-pager | tail -n 30

Check general mail logs:

sudo tail -f /var/log/mail.log | grep -i dovecot
# On some systems:
sudo tail -f /var/log/mail.err

Common errors and their meanings:

  • "Mailbox not found" > Incorrect mail_location path or missing directory.
  • "Permission denied" > Wrong ownership or permissions on mail directory.
  • "Connection refused" > LMTP service not running or wrong socket path.
  • "User doesn't exist" > Authentication/user database misconfiguration.

Summary

Issue Fix
Mail not delivered to virtual users Check mail_location in /etc/dovecot/conf.d/10-mail.conf
LMTP connection errors Enable and configure LMTP in /etc/dovecot/conf.d/10-master.conf and match Postfix settings
Permission issues Run chown -R vmail:vmail /var/mail/vhosts and set mail_uid/mail_gid
Missing virtual mail directory Create directory structure (e.g., /var/mail/vhosts/example.com/user/Maildir) with correct ownership
Need to check logs for errors Use journalctl -u dovecot or tail -f /var/log/mail.log

By systematically checking these configuration areas, your Dovecot virtual mail delivery should work correctly!

Frequently asked questions
`ss -lx | grep dovecot-lmtp` should show a Unix socket; `ss -tnlp | grep 24` for the TCP option. If neither shows up, Dovecot's `service lmtp { }` block is misconfigured or commented out. After fixing config, full restart: `systemctl restart dovecot` (a reload sometimes doesn't pick up new listeners).
Almost always socket owner mismatch. The socket is owned by Dovecot's user; Postfix runs as `postfix`. Set in dovecot config: `service lmtp { unix_listener /var/spool/postfix/private/dovecot-lmtp { user = postfix; group = postfix; mode = 0600; } }`. Place the socket in Postfix's chroot. Reload Dovecot.
Sieve filtering is the usual culprit. Check `~/sieve/active.sieve` or Dovecot's per-user sieve directory for misrouting rules. If you didn't set up Sieve, it shouldn't run — verify `protocol lmtp { mail_plugins = }` doesn't have `sieve` enabled if you don't want it.
`mail_location = maildir:~/Maildir` requires the user owns ~/Maildir. For virtual users (where users don't exist in /etc/passwd), set `mail_uid = vmail / mail_gid = vmail` globally so all mail is owned by the vmail user. Then `chown -R vmail:vmail /var/vmail/`. Common mistake is per-user different ownership for virtual mailbox setups.
Related articles
Understanding dovecot_virtual_delivery in Dovecot Mail Server
Fixing session_start(): Permission Denied (13) in XAMPP — System Administrator's Guide
Fixing session_start(): Permission Denied (13) — Verify PHP Configuration (php.ini)