Dovecot - plus sign in mailbox name
I have a mailserver build with Postfix for SMTP and Dovecot for mail storage (with mailboxes stored in MySQL db). One of the users created mailbox with plus sign in its name, like this:
Dovecot doesn't seem to handle that mailbox name as usual. When i try to lookup that mailbox with doveadm, it fails
# doveadm user [email protected]
field valueuserdb lookup: user [email protected] doesn't exist
On the other hand, when i do the lookup with wildcard, it shows this:
# doveadm user 'peter*[email protected]'
[email protected]
# doveadm user '*@example.com'
[email protected]
(...)
[email protected]
Anyway - the mailbox with the plus sign is unusable, you cannot login to it.
When the mail is send to that mailbox - Postfix treats it like any other, so it forwards it to Dovecot (in my case via LMTP) to mailbox [email protected]. But Dovecot tries to deliver it to [email protected] (ignoring everything starting with the plus sign).
It appears that Dovecot is handeling the plus sign like Gmail or other mail servers:
https://notfaq.wordpress.com/2006/07/20/plus-sign-in-email-addresses/ http://gmailblog.blogspot.cz/2008/03/2-hidden-ways-to-get-more-from-your.html
My question is:
- Does Dovecot realy treating plus the sign in special way like i described or is this some kind of misbehavior? I search the Dovecot documentation and didn't find anything also I didn't find anything useful while searching the net.
- If this is a feature, can it be disabled (so the '+' sign wouldn't be treated specialy)?
The feature that [email protected]
gets delivered to [email protected]
is called "sub addressing" or "plus addressing" and is nicely described on Wikipedia.
Advanced users find it very useful and you might think twice about disabling it if you already have a large existing userbase because disabling it might break more than it fixes. IMHO you should patch your mailbox provisioning front-end to reject mailbox names with a + instead.
In postfix sub-addressing is configured with the recipient_delimiter
, simply remove that directive and sub-addressing will be disabled.
As I mentioned already, sub-addressing is quite useful and you might want to investigate how Dovecot currently deals with sub addressing as the manual offers different options.
The following will deliver mail for [email protected]
to a specific folder named extension
in the users mailbox:
dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/local/libexec/dovecot/dovecot-lda -f ${sender} -d ${user}@${nexthop} -m ${extension}
or if you have a INBOX/ namespace prefix:
dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/local/libexec/dovecot/dovecot-lda -f ${sender} -d ${user}@${nexthop} -m INBOX/${extension}
or Dovecot can ignore the extension completely and deliver all messages to the main INBOX
dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/dovecot-lda -f ${sender} -a ${recipient} -d ${user}@${nexthop}