3

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:

  1. 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.
  2. If this is a feature, can it be disabled (so the '+' sign wouldn't be treated specialy)?
3

The feature that mailbox+aextension@example.com gets delivered to mailbox@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 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}

  • I wasn't sure if "sub addressing" is a Dovecot feature or not, because i didnt find anything about it in the documentation. Now its clear, thank you. – dave Jan 12 '16 at 14:38
  • Yep it is mostly handled by Postfix rather than Dovecot. – HBruijn Jan 12 '16 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.