[Dovecot] Recipient delimiters, deliver and SQL databases

Nils Vogels nivo+sender+9bb457 at is-root.com
Sat Dec 9 16:56:20 UTC 2006


As a new user, I'm trying to set up a postfix + dovecot combination, and
so far all is running smoothly.
I'm using the guidelines that came with postfix and adjusting them as I go.

My user and alias database is stored in MySQL, using the scheme from
'PostfixAdmin' (http://high5.net/page9.html) and I am using the dovecot
LDA 'deliver' to drop messages into mailboxes that exist solely as
virtual users.

Users can login using both pop3 and imap, and retrieve the e-mails sent
directly to them, so I'm happy with that.

One of the features supported by postfix, and required for my setup is
recipient delimiters. Using recipient delimiters, you can basically send
extra information in the e-mail address, to maybe deliver the message
into subfolders directly, or to run anti-spam software such as TMDA against.

When I try to deliver such a message, I get a user unknown:

Dec  9 14:25:01 vm-mail postfix/pickup[91477]: 4574A6420: uid=0 from=<root>
Dec  9 14:25:01 vm-mail postfix/cleanup[91487]: 4574A6420:
message-id=<20061209142501.4574A6420 at vm-mail.mydomain>
Dec  9 14:25:01 vm-mail postfix/qmgr[91478]: 4574A6420:
from=<root at vm-mail.mydomain>, size=290, nrcpt=1 (queue active)
Dec  9 14:25:01 vm-mail dovecot: auth(default): master in: USER 1      
user+test at mydomain     service=deliver
Dec  9 14:25:01 vm-mail dovecot: auth-worker(default):
sql(user+test at mydomain): SELECT maildir, 143 AS uid, 143 AS gid FROM
mailbox WHERE username = 'user+test at mydomain' AND active = '1'
Dec  9 14:25:01 vm-mail dovecot: auth-worker(default):
sql(user+test at mydomain): User not found
Dec  9 14:25:01 vm-mail dovecot: auth(default): master out: NOTFOUND    1
Dec  9 14:25:01 vm-mail postfix/pipe[91489]: 4574A6420:
to=<user+test at mydomain>, relay=dovecot, delay=0.14,
delays=0.07/0.03/0/0.04, dsn=5.1.1, status=bounced (user unknown)

Relevant snippets from postfix's master.cf:

# Dovecot LDA
dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=dovecot:dovecot
argv=/usr/local/libexec/dovecot/deliver -d ${recipient}

and postfix's main.cf:

virtual_gid_maps = static:143
virtual_mailbox_base = /mail/virtual
virtual_minimum_uid = 125
dovecot_destination_recipient_limit = 1
virtual_transport = dovecot
virtual_uid_maps = static:143

and dovecot's dovecot.conf:

protocol lda {
  postmaster_address = postmaster at mydomain
  sendmail_path = /usr/sbin/sendmail
  auth_socket_path = /var/run/dovecot-auth-master

auth default {

  passdb sql {
        args = /usr/local/etc/dovecot-mysql.conf

  userdb sql {
        args = /usr/local/etc/dovecot-mysql.conf

  socket listen {
    client {
      path = /var/spool/postfix/private/auth
      mode = 0660
      user = postfix
      group = postfix

    master {
      path = /var/run/dovecot-auth-master
      mode = 0600
      user = dovecot
      group = dovecot

And offcourse dovecot-mysql.conf:

# Database driver: mysql, pgsql
driver = mysql

# Currently supported schemes include PLAIN, PLAIN-MD5, DIGEST-MD5, and
default_pass_scheme = CRYPT

# Database options
connect = host=myhost dbname=mydb user=myuser password=mypass

password_query = SELECT password FROM mailbox WHERE username = '%u' AND
active = '1'
user_query = SELECT maildir, 143 AS uid, 143 AS gid FROM mailbox WHERE
username = '%u' AND active = '1'

Now, I am pretty sure the problem lies with the %u, expanding to
user+test at mydomain, which in some way should become user at mydomain, since
the latter is the actual mailbox name of the user, but: how?

Thanks in advance,


Those who desire to give up freedom in order to gain security, will not have, nor do they deserve, either one.

~Benjamin Franklin (American Statesman, Scientist, Philosopher, Printer, Writer and Inventor. 1706-1790)

More information about the dovecot mailing list