Hi again! I manage to solve this by removing the option auth_username_translation. The reason I wanted to have auth_username_translation was to be able to let sieve handle <mail-attribute><auth_username_translation><extension> Is this possible with other configuration options? //Robban ----- Forwarded message from Robban <dovecot at netnerdz.se> ----- Date: Mon, 2 May 2016 20:15:48 +0200 From: Robban <dovecot at netnerdz.se> To: dovecot at dovecot.org Subject: %{domain} (or %d) is empty User-Agent: Mutt/1.5.21 (2010-09-15) Hi all! I have two userdb's, for one of them it's ldap based and the 2nd one is static. I want mail to ldap-users to be saved in /home/vmail/<username>/Maildir So far so good. Now I want mail to non-existent users to be placed in /home/vmail/<domain.tld>/Maildir (notice the double-slashes that indicate that %d is empty): # doveadm user publicfolder at vendelso.se rs at netnerdz.se field value uid 500 gid 500 home /home/vmail// mail maildir:/home/vmail//Maildir/ uid vmail gid vmail home /home/vmail/rs mail maildir:/home/vmail/rs uidNumber 500 gidNumber 500 And here's my configuration files: # cat /etc/dovecot/dovecot-ldap.conf.ext hosts = 172.20.202.60 dn=uid=dovecot,cn=sysaccounts,cn=etc,dc=netnerdz,dc=se dnpass=<suppressed> auth_bind = yes auth_bind_userdn = uid=%u,cn=users,cn=accounts,dc=netnerdz,dc=se ldap_version = 3 base = cn=accounts,dc=netnerdz,dc=se deref = never scope = subtree user_filter = (&(objectClass=posixAccount)(mail=%u@*)) user_attrs = \ =user=%{ldap:uid}, \ =home=/home/vmail/%{ldap:uid}, \ =mail=maildir:/home/vmail/%{ldap:uid}, \ =uidNumber=500, \ =gidNumber=500 pass_filter = (&(objectClass=posixAccount)(mail=%u@*)) pass_attrs = uid=user,userPassword=password # dovecot -n # 2.2.10: /etc/dovecot/dovecot.conf # OS: Linux 3.10.0-327.10.1.el7.x86_64 x86_64 CentOS Linux release 7.2.1511 (Core) auth_mechanisms = login gssapi plain auth_socket_path = /var/run/dovecot/auth-userdb auth_username_format = %n auth_username_translation = - at .@/@_@ auth_verbose = yes base_dir = /var/run/dovecot/ imap_id_log = * imap_id_send = name imap_urlauth_host = * import_environment = TZ lda_mailbox_autocreate = yes lda_mailbox_autosubscribe = yes lda_original_recipient_header = X-Original-To lmtp_save_to_detail_mailbox = yes login_greeting = IMAPd ready. login_log_format_elements = user=<%u> method=%m rip=%r lip=%l mpid=%e %c mail_access_groups = vmail mail_attachment_hash = %{sha256} mail_debug = yes mail_gid = vmail mail_location = maildir:~/Maildir mail_log_prefix = "%s(%u)::%n: " mail_plugins = acl virtual mail_privileged_group = vmail mail_shared_explicit_inbox = yes mail_uid = vmail mailbox_list_index = yes maildir_broken_filename_sizes = yes managesieve_notify_capability = mailto managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave mmap_disable = yes namespace NetnerdzSE { list = yes location = maildir:/home/vmail/netnerdz.se/:INDEX=/home/vmail/%u/public prefix = NetnerdzSE/ separator = / subscriptions = yes type = public } namespace Shared { list = children location = maildir:/home/vmail/%%n/Maildir/:INDEX=/home/vmail/%n/shared/%%u prefix = Shared/%%n/ separator = / subscriptions = yes type = shared } namespace Vendels?SE { list = yes location = maildir:/home/vmail/xn--vendels-g1a.se/:INDEX=/home/vmail/%u/public prefix = Vendels?SE/ separator = / subscriptions = yes type = public } namespace VendelsoSE { list = yes location = maildir:/home/vmail/vendelso.se/:INDEX=/home/vmail/%u/public prefix = VendelsoSE/ separator = / subscriptions = yes type = public } namespace inbox { hidden = no inbox = yes list = yes location mailbox Archive { auto = subscribe special_use = \Archive } mailbox Drafts { auto = subscribe special_use = \Drafts } mailbox Junk { auto = subscribe special_use = \Junk } mailbox Sent { auto = subscribe special_use = \Sent } mailbox Trash { auto = subscribe special_use = \Trash } prefix separator = / subscriptions = yes type = private } passdb { args = /etc/dovecot/dovecot-ldap.conf.ext driver = ldap } plugin { acl = vfile:/home/vmail/dovecot-acl acl_shared_dict = file:/home/vmail/shared-mailboxes.db mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename mail_log_fields = uid box msgid size sieve = /home/vmail/%u/dovecot.sieve sieve_default = /etc/dovecot/default.sieve sieve_default_name = roundcube sieve_dir = /home/vmail/%u/sieve sieve_global_dir = /etc/dovecot/sieve/global.sieve sieve_global_path = /etc/dovecot/sieve/global.sieve sieve_max_actions = 0 sieve_max_redirects = 4 sieve_max_script_size = 0 } postmaster_address = postmaster@%d protocols = imap lmtp sieve service auth-worker { user = root } service auth { unix_listener /var/spool/postfix/private/auth { mode = 0666 } unix_listener auth-client { group = postfix mode = 0660 user = postfix } unix_listener auth-master { group = vmail mode = 0660 user = vmail } unix_listener auth-userdb { group mode = 0666 user } user = $default_internal_user } service dict { unix_listener dict { group = mail mode = 0600 user = mail } } service imap-login { inet_listener imap { port = 143 } inet_listener imaps { port = 993 ssl = yes } process_min_avail = 0 service_count = 1 vsz_limit = 256 M } service imap { process_limit = 1024 vsz_limit = 256 M } service lmtp { inet_listener lmtp { address = 127.0.0.1 port = 24 } unix_listener lmtp { mode = 0666 } } service managesieve-login { inet_listener sieve { port = 4190 } } ssl = required ssl_ca = </etc/dovecot/dovecot-ca.crt ssl_cert = </etc/dovecot/imap.netnerdz.se.crt ssl_client_ca_file = /etc/pki/tls/cert.pem ssl_key = </etc/dovecot/imap.netnerdz.se.key ssl_prefer_server_ciphers = yes submission_host = 127.0.0.1:25 userdb { args = /etc/dovecot/dovecot-ldap.conf.ext driver = ldap } userdb { args = uid=500 gid=500 home=/home/vmail/%{domain}/ allow_all_users=yes driver = static override_fields = mail=maildir:/home/vmail/%d/Maildir/ result_failure = return-ok skip = found } valid_chroot_dirs = /home/vmail verbose_proctitle = yes protocol sieve { disable_plaintext_auth = yes info_log_path = /var/log/dovecot/dovecot-sieve.log log_path = /var/log/dovecot/dovecot-sieve-errors.log managesieve_implementation_string = dovecot managesieve_max_line_length = 65536 } protocol lda { auth_socket_path = /var/run/dovecot/auth-master info_log_path = /var/log/dovecot/dovecot-lda.log log_path = /var/log/dovecot/dovecot-lda-errors.log mail_plugins = acl virtual sieve postmaster_address = postmaster } protocol imap { mail_max_userip_connections = 10 mail_plugins = acl virtual imap_acl } protocol lmtp { info_log_path = /var/log/dovecot/dovecot-lmtp.log log_path = /var/log/dovecot/dovecot-lmtp-errors.log mail_plugins = acl virtual sieve postmaster_address = postmaster } -- Robert Soderlund ----- End forwarded message ----- -- Robert Soderlund