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:
peter+bob@example.com
Dovecot doesn't seem to handle that mailbox name as usual. When i try to lookup that mailbox with doveadm, it fails
# doveadm user peter+bob@example.com
field valueuserdb lookup: user peter+bob@example.com doesn't exist
On the other hand, when i do the lookup with wildcard, it shows this:
# doveadm user 'peter*bob@example.com'
peter+bob@example.com
# doveadm user '*@example.com'
peter@example.com
(...)
peter+bob@example.com
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 peter+bob@example.com. But Dovecot tries to deliver it to peter@example.com (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)?
Best Answer
The feature that
mailbox+aextension@example.com
gets delivered tomailbox@example.com
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
user+extension@exampel.com
to a specific folder namedextension
in the users mailbox:or if you have a INBOX/ namespace prefix:
or Dovecot can ignore the extension completely and deliver all messages to the main INBOX