Fix lmtp_save_to_detail_mailbox to be case insensitive?

dovecot at ptld.com dovecot at ptld.com
Sat May 21 21:30:37 UTC 2022


> On 05-21-2022 2:29 pm, Benny Pedersen wrote:
> On 2022-05-21 19:17, dovecot at ptld.com wrote:
>> To bring this up again because i have not found a work around solution.
>> Can dovecot make lmtp_save_to_detail_mailbox case-insensitive?
>>
>> If you create a folder "foobar" then an email with recipient
>> user+foobar at example.com will be placed in the folder.
>>
>> However with the folder as "foobar" an email with recipient
>> user+FOOBAR at example.com will report folder "FOOBAR" not found and the
>> email will be placed in the inbox folder.
> 
> i belive if you post doveconf -n you will get more help :)
> 
> and as i sayed on postfix-millist, change %u to %Lu will solve it, if that does not solve it, we have a dokumented bug
> then
> 
> # /etc/dovecot/conf.d/10-auth.conf
> auth_username_format = %Lu


I fail to understand how the suggestion of %Lu has anything to do with what im talking about.
I don't set auth_username_format in conf and let it use the default of %Lu

    doveconf -a | grep auth_username_format
    auth_username_format = %Lu

I do not believe that setting has anything to do with the issue.
Maybe im failing to property convey the issue and i will try to get more verbose.
I am setting the following:

    recipient_delimiter = +-
    lmtp_save_to_detail_mailbox = yes

None of that has anything to do with the lookups.
Dovecot accepts the mail from postfix via LMTP. Dovecot already found the valid recipient and accepted the email.

With lmtp_save_to_detail_mailbox enabled, after accepting the email but before placing it in the inbox, dovecot will look for any folders matching the address extension detail and place the email in that folder instead of the default inbox.

This only works if the case matches between the recipient provided by the sender (which we have no
control over) and the folder name. For example, i create a folder "foobar" and tell you to send an email to user+foobar at example.com. But instead you type User+FooBar at Example.com. This email will not be placed into the "foobar" folder and the logs will generate a warning of folder "FooBar" not found.

It will only work as expected if the folder "foobar" and the address "user+foobar at example.com" match case exactly. I feel this should be something built into dovecot to do case-insensitive folder matching to the user address extension detail beyond the delimiter. I can not think of a reason you wouldn't want user+FOOBAR at example.com to NOT be placed into your "foobar" folder if you have taken the steps to set the feature up.

    https://doc.dovecot.org/settings/core/?highlight=lmtp_save_to_detail_mailbox#core_setting-lmtp_save_to_detail_mailbox
    https://doc.dovecot.org/configuration_manual/protocols/lmtp_server/?highlight=lmtp_save_to_detail_mailbox

Here are the redacted LMTP logs:


   dovecot[40891]: lmtp(user at example.com)<40889><...>: msgid=<... at example.com>: save failed to open mailbox FooBar: Mailbox doesn't exist: FooBar
    dovecot[40891]: lmtp(user at example.com)<40889><...>: msgid=<... at example.com>: saved mail to INBOX

Just to humor the %Lu suggestion i explicitly put "auth_username_format = %Lu" in the conf, instead of relying on the default, and it still has the same behavior.
I believe this is something that has to be fixed in the dovecot code but i can't seem to get Aki's attention on this issue.
Im open to more trouble shooting suggestions.


More information about the dovecot mailing list