[Dovecot] configure lmtp to deliver to email addresses case insensitively

Adrian Zaugg adi at ente.limmat.ch
Wed Dec 18 03:01:03 EET 2013

Hi again

Thanks for helping me on this, especially to Steffen. If you do not need
case sensitivity on user names the use of a redirect router in exim to
lowercase the local part of the address to deliver works well.

If one wants for whatever reasons to have support for user names, that
just differ in its case, you could put more logic in that router to make
that work. Since I did not need that, I can't post it here...

So the solution to the problem is:

A) Either:
Configure dovecot auth to lower case user names, which LMTP inherits, by
	auth_username_format = "%Lu"

Co-Effect: authenticating logins with wrongly cased user names do also

B) Or:
Configure your MTA to do the Job. With exim, add a new router just
before local delivery takes place, like this:

  debug_print = "R: lower case local_part for local delivery"
  driver = redirect
  redirect_router = local_user
  data = ${lc:${local_part}}

and proceed with the local_user router:

  debug_print = "R: local_user for $local_part@$domain"
  driver = accept
  domains = +local_domains
  local_parts = ! root
  transport = dovecot_lmtp
  cannot_route_message = Unknown user

then add your LMTP transport:

  driver = lmtp
  socket = /var/run/dovecot/lmtp
  batch_max = 256
  timeout = 2m

Has just the effect that login names stay case sensitive (if nothing
else is set in dovecot by auth_username_format) but not email addresses,
and in spite of being treated as case insensitive, email addresses
retain their case.

Maybe some one can add this to the wiki under
The code there is anyway not very nice by using the manualroute router with:
   route_data = whatmeworry # required but not useful

Thanks again to everyone for helping.

Regards, Adrian.

Am 17.12.13 09:38 schrieb Steffen Kaiser:
> On Tue, 17 Dec 2013, Steffen Kaiser wrote:
>>> However, it's maybe best to lowercase the local part in the exim
>>> lmtp-transport and leave dovecot's LMTP in peace.
>> that's what I wanted to suggest :)
>> More or less, it is the duty of the MTA, IMHO.
> Um, sorry, forgot the link:
> http://www.gossamer-threads.com/lists/exim/users/4551
> that looks promising.
> -- Steffen Kaiser

More information about the dovecot mailing list