[GH-ISSUE #292] case sensitive mail confusion #276

Closed
opened 2026-02-27 11:10:56 +03:00 by kerem · 7 comments
Owner

Originally created by @tonioo on GitHub (Dec 4, 2013).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/292

Originally assigned to: @tonioo on GitHub.

Originally created by Walter Doekes on 2012-07-16T09:45:43Z

Hi,

no sane person wants case sensitive e-mail addresses (of which only the local part is sensitive).
Therefore we should always convert the email to lowercase before saving.

  • Usernames are already case insensitive (on a default mysql install) with the auth backend, even when they get stored in upper case. We're not touching this for now.
  • For forwards/aliases are a different matter. As the destination server may make a case distinction and if it doesn't, it will treat the e-mail as lowercase.

For local accounts lowercase email should be considered as mandatory

Why?

  • Many tablets begin input fields with an upper case letter: Myname@mydomain.com.
  • Dovecot will open the Maildir with the capital in it.
  • Default postfix-dovecot-lda example shows master.cf flags=..hu, meaning lowercase folding of username (and domain) => files now get stored by LDA in "myname/" instead of "Myname/" (when we use userdb { ... allow_all_users=yes } on the lda).

Result: Myname-user doesn't get any mail, because it goes in myname-directory.

The hard fix is to ensure that all of postfix and/or dovecot preserves case along the way.
The easy fix is to fold the e-mail to lowercase at creation time and that is what the attached patch does.

The patch also does the following:

  • make User searches case insensitive
  • make User searches search for email as well

Regards,
Walter Doekes
OSSO B.V.

Originally created by @tonioo on GitHub (Dec 4, 2013). Original GitHub issue: https://github.com/modoboa/modoboa/issues/292 Originally assigned to: @tonioo on GitHub. **Originally created by Walter Doekes on 2012-07-16T09:45:43Z** Hi, no sane person wants case sensitive e-mail addresses (of which only the local part is sensitive). Therefore we should always convert the email to lowercase before saving. - Usernames are already case insensitive (on a default mysql install) with the auth backend, even when they get stored in upper case. We're not touching this for now. - For forwards/aliases are a different matter. As the destination server may make a case distinction and if it doesn't, it will treat the e-mail as lowercase. _For local accounts lowercase email should be considered as mandatory_ Why? - Many tablets begin input fields with an upper case letter: Myname@mydomain.com. - Dovecot will open the Maildir with the capital in it. - Default postfix-dovecot-lda example shows master.cf flags=..hu, meaning lowercase folding of username (and domain) => files now get stored by LDA in "myname/" instead of "Myname/" (when we use userdb { ... allow_all_users=yes } on the lda). Result: Myname-user doesn't get any mail, because it goes in myname-directory. The hard fix is to ensure that all of postfix and/or dovecot preserves case along the way. The easy fix is to fold the e-mail to lowercase at creation time and that is what the attached patch does. The patch also does the following: - make User searches case insensitive - make User searches search for email as well Regards, Walter Doekes OSSO B.V.
kerem 2026-02-27 11:10:56 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@tonioo commented on GitHub (Dec 4, 2013):

Posted by Antoine Nguyen on 2012-07-16T18:20:00Z

Hi Walter,

Indeed lowercase usernames should be safer and I don't see (atm) any situation where it can be anoying.

About your patch, I agree with case insensitive search but not with including the email field in queries. Why?

An account (a User instance) isn't always associated to a mailbox. For this reason, the email field is not always filled. Otherwise, username and email fields are the same for simple users. The only case where it could be useful concerns admins (super and domain) with a mailbox and a username that is not an email address.

I need to check this before applying/modifying your patch. Why did you change that?

<!-- gh-comment-id:29815716 --> @tonioo commented on GitHub (Dec 4, 2013): **Posted by Antoine Nguyen on 2012-07-16T18:20:00Z** Hi Walter, Indeed lowercase usernames should be safer and I don't see (atm) any situation where it can be anoying. About your patch, I agree with case insensitive search but not with including the email field in queries. Why? An account (a User instance) isn't always associated to a mailbox. For this reason, the email field is not always filled. Otherwise, username and email fields are the same for simple users. The only case where it could be useful concerns admins (super and domain) with a mailbox and a username that is not an email address. I need to check this before applying/modifying your patch. Why did you change that?
Author
Owner

@tonioo commented on GitHub (Dec 4, 2013):

Posted by Walter Doekes on 2012-07-19T07:48:00Z

I agree [...] not with including the email field in queries. Why?

An account (a User instance) isn't always associated to a mailbox. For this reason, the email
field is not always filled.

Ok.. but if it isn't filled, the search will not return any hits for it. So it doesn't bother you.

Otherwise, username and email fields are the same for simple users. The only case where it
could be useful concerns admins (super and domain) with a mailbox and a username that is not
an email address.

Well yes.. this was the first thing I noticed when I searched and couldn't find my recently created entries.

I'll probably patch the search some more to find alias/dlist/forwards a little better too. But that's for later.

Regards,
Walter

<!-- gh-comment-id:29815717 --> @tonioo commented on GitHub (Dec 4, 2013): **Posted by Walter Doekes on 2012-07-19T07:48:00Z** > I agree [...] not with including the email field in queries. Why? > > An account (a User instance) isn't always associated to a mailbox. For this reason, the email > field is not always filled. Ok.. but if it isn't filled, the search will not return any hits for it. So it doesn't bother you. > Otherwise, username and email fields are the same for simple users. The only case where it > could be useful concerns admins (super and domain) with a mailbox and a username that is not > an email address. Well yes.. this was the first thing I noticed when I searched and couldn't find my recently created entries. I'll probably patch the search some more to find alias/dlist/forwards a little better too. But that's for later. Regards, Walter
Author
Owner

@tonioo commented on GitHub (Dec 4, 2013):

Posted by Antoine Nguyen on 2012-07-19T08:15:55Z

Walter Doekes wrote:

Ok.. but if it isn't filled, the search will not return any hits for it. So it doesn't bother you.

That's true...

Well yes.. this was the first thing I noticed when I searched and couldn't find my recently created entries.

I'll probably patch the search some more to find alias/dlist/forwards a little better too. But that's for later.

Ok. So I'll wait for your modification before including this patch.

<!-- gh-comment-id:29815719 --> @tonioo commented on GitHub (Dec 4, 2013): **Posted by Antoine Nguyen on 2012-07-19T08:15:55Z** Walter Doekes wrote: > Ok.. but if it isn't filled, the search will not return any hits for it. So it doesn't bother you. That's true... > Well yes.. this was the first thing I noticed when I searched and couldn't find my recently created entries. > > I'll probably patch the search some more to find alias/dlist/forwards a little better too. But that's for later. Ok. So I'll wait for your modification before including this patch.
Author
Owner

@tonioo commented on GitHub (Dec 4, 2013):

Posted by Antoine Nguyen on 2012-08-02T19:25:48Z

Hi Walter,

nothing new about that ?

<!-- gh-comment-id:29815720 --> @tonioo commented on GitHub (Dec 4, 2013): **Posted by Antoine Nguyen on 2012-08-02T19:25:48Z** Hi Walter, nothing new about that ?
Author
Owner

@tonioo commented on GitHub (Dec 4, 2013):

Posted by Walter Doekes on 2012-08-03T19:17:38Z

I'm on holiday..

So no, not right now =)

Can't promise when I'll work on it, but I'll probably find a window by the end of the month.

<!-- gh-comment-id:29815723 --> @tonioo commented on GitHub (Dec 4, 2013): **Posted by Walter Doekes on 2012-08-03T19:17:38Z** I'm on holiday.. So no, not right now =) Can't promise when I'll work on it, but I'll probably find a window by the end of the month.
Author
Owner

@tonioo commented on GitHub (Dec 4, 2013):

Posted by Antoine Nguyen on 2012-09-22T08:43:22Z

Walter Doekes wrote:

I'm on holiday..

So no, not right now =)

Can't promise when I'll work on it, but I'll probably find a window by the end of the month.

Hi,

did you find some time to work on that ?

Antoine

<!-- gh-comment-id:29815724 --> @tonioo commented on GitHub (Dec 4, 2013): **Posted by Antoine Nguyen on 2012-09-22T08:43:22Z** Walter Doekes wrote: > I'm on holiday.. > > So no, not right now =) > > Can't promise when I'll work on it, but I'll probably find a window by the end of the month. Hi, did you find some time to work on that ? Antoine
Author
Owner

@tonioo commented on GitHub (Dec 4, 2013):

Posted by Antoine Nguyen on 2012-10-04T17:24:42Z

I've applied partially your patch. I now force lower case emails (always) and lower case usernames only for simple users.

I'll create a new ticket about improving the search queries.

<!-- gh-comment-id:29815725 --> @tonioo commented on GitHub (Dec 4, 2013): **Posted by Antoine Nguyen on 2012-10-04T17:24:42Z** I've applied partially your patch. I now force lower case emails (always) and lower case usernames only for simple users. I'll create a new ticket about improving the search queries.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#276
No description provided.