dovecot_virtual_delivery is not an official Dovecot setting but a common troubleshooting term that refers to how Dovecot handles virtual mail delivery. Dovecot is primarily an IMAP/POP3 server but can also function as a Local Delivery Agent (LDA) for virtual mail users.
If you are facing mail delivery issues related to Dovecot's virtual user system, the problem may be with:
Dovecot delivers emails in two common ways:
Check which method your system uses:
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
}
If your system uses virtual mail users, make sure Dovecot is properly configured.
Edit the main Dovecot configuration file:
Ensure the following settings are correct for a typical Maildir setup:
mail_location = maildir:/var/mail/vhosts/%d/%n
Where:
/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:
If using Dovecot LMTP (recommended), ensure it's properly configured to communicate with Postfix.
Edit the master configuration file:
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:
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:
If the user doesn't exist, create it:
2. Set correct ownership on your mail storage directory:
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:
If mail delivery still fails, check system logs for specific error messages.
Check Dovecot service logs:
Check general mail logs:
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.| 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!