[Dovecot] Case-insensitive "detail" mailboxes?
We're using sieve with LMTP. We want to have lda_mailbox_autocreate and lmtp_save_to_detail_mailbox. Is there a way to make the "detail" case-insensitive? If so I have not found it yet.
I suppose we could lowercase the input string for the SQL userdb query, but that's not what is wanted. The idea being that if a user makes a mailbox called "Test" is that user+test@example.com and user+TEST@example.com should both go to that "Test" mailbox. If it was lowercased, a mailbox called "Test" would be ignored and "test" used.
With autocreate, this could be a problem if mail is delivered to autocreated case-sensitive mailboxes that the user won't see.
Hmmm, maybe a global sieve script?
http://rob0.nodns4.us/ -- system administration and consulting Offlist GMX mail is seen only if "/dev/rob0" is in the Subject:
On 25.7.2013, at 19.29, /dev/rob0 rob0@gmx.co.uk wrote:
We're using sieve with LMTP. We want to have lda_mailbox_autocreate and lmtp_save_to_detail_mailbox. Is there a way to make the "detail" case-insensitive? If so I have not found it yet.
I suppose we could lowercase the input string for the SQL userdb query, but that's not what is wanted. The idea being that if a user makes a mailbox called "Test" is that user+test@example.com and user+TEST@example.com should both go to that "Test" mailbox. If it was lowercased, a mailbox called "Test" would be ignored and "test" used.
With autocreate, this could be a problem if mail is delivered to autocreated case-sensitive mailboxes that the user won't see.
If you used case-insensitive filesystem, it would already work like that. Maybe a new setting to make mailboxes case-insensitive also with case-sensitive filesystems..
On 25.7.2013, at 19.43, Timo Sirainen tss@iki.fi wrote:
On 25.7.2013, at 19.29, /dev/rob0 rob0@gmx.co.uk wrote:
We're using sieve with LMTP. We want to have lda_mailbox_autocreate and lmtp_save_to_detail_mailbox. Is there a way to make the "detail" case-insensitive? If so I have not found it yet.
I suppose we could lowercase the input string for the SQL userdb query, but that's not what is wanted. The idea being that if a user makes a mailbox called "Test" is that user+test@example.com and user+TEST@example.com should both go to that "Test" mailbox. If it was lowercased, a mailbox called "Test" would be ignored and "test" used.
With autocreate, this could be a problem if mail is delivered to autocreated case-sensitive mailboxes that the user won't see.
If you used case-insensitive filesystem, it would already work like that. Maybe a new setting to make mailboxes case-insensitive also with case-sensitive filesystems..
Oh, except then you get into trouble with non-ASCII characters. Which unicode chars should be equal? Maybe i;unicode-casemap would work well enough, since it's also used for other purposes.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Thu, 25 Jul 2013, Timo Sirainen wrote:
On 25.7.2013, at 19.43, Timo Sirainen tss@iki.fi wrote:
On 25.7.2013, at 19.29, /dev/rob0 rob0@gmx.co.uk wrote:
We're using sieve with LMTP. We want to have lda_mailbox_autocreate and lmtp_save_to_detail_mailbox. Is there a way to make the "detail" case-insensitive? If so I have not found it yet.
I suppose we could lowercase the input string for the SQL userdb query, but that's not what is wanted. The idea being that if a user makes a mailbox called "Test" is that user+test@example.com and user+TEST@example.com should both go to that "Test" mailbox. If it was lowercased, a mailbox called "Test" would be ignored and "test" used.
With autocreate, this could be a problem if mail is delivered to autocreated case-sensitive mailboxes that the user won't see.
If you used case-insensitive filesystem, it would already work like that. Maybe a new setting to make mailboxes case-insensitive also with case-sensitive filesystems..
Oh, except then you get into trouble with non-ASCII characters. Which unicode chars should be equal? Maybe i;unicode-casemap would work well enough, since it's also used for other purposes.
I see two other solvable problems:
"if a user makes a mailbox called "Test" is that user+test@example.com and user+TEST@example.com should both go to that "Test" mailbox."
Hence, the delivery process would need some sort of mapping (dict):
case-insensitive -> real spelling
i.e. the user creates teSt or teST a.s.o., in order to find the correct mailbox name in case-sensitive filesystems efficiently.
Secondly, what happens, if the user wants to create two mailboxes with different case, say Test and tesT and test ? Either this is forbidden or the delivery process needs to first check, if there is a mailbox with the very exact name, but which one is to choose, if neither matches? Personally, I would forbid two mailboxes that differs in case only, if such mechanism is enabled.
Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux)
iQEVAwUBUfIO/F3r2wJMiz2NAQKUVggAhLSRrCiYvxEP5WKONqa78upQbER78Mo6 hW+7q6MJaGe28Hc7vROgV0pYzr3+zV5jBbWJescYrjAqsJ3Oeao39XQwJM8UWHOJ agfNkzytjyCW/KMtpXrzGdX0H2Cv49ek5bjKDeG8XDLJZuy0azen7aXxsNYXKC0X D31MslQkJ3VSlcyZiu/KTbo0caQyCx4Pyj5exTOp9aoAjL6SGaIyZvzSjfFwrJUx 2TuF7YtPr5PyH2OPG2T8uraw+TNm2St+oM04dG8BgOTo8p5Q0DO2OtuFTTZvVxtu 14bc8fomuYruAvrT0uoGJxSpUU1PID5UNEK2bj4Nw8bAm+C73Z6aAA== =1RLr -----END PGP SIGNATURE-----
On Thu, Jul 25, 2013 at 11:29:56AM -0500, /dev/rob0 wrote:
We're using sieve with LMTP. We want to have lda_mailbox_autocreate and lmtp_save_to_detail_mailbox. Is there a way to make the "detail" case-insensitive? If so I have not found it yet.
I suppose we could lowercase the input string for the SQL userdb query, but that's not what is wanted. The idea being that if a user makes a mailbox called "Test" is that user+test@example.com and user+TEST@example.com should both go to that "Test" mailbox. If it was lowercased, a mailbox called "Test" would be ignored and "test" used.
With autocreate, this could be a problem if mail is delivered to autocreated case-sensitive mailboxes that the user won't see.
Hmmm, maybe a global sieve script?
I use the following sieve snippet rather than lmtp_save_to_detail_mailbox:
if envelope :detail :regex "to" "(.+)" { set :upperfirst :lower "detail" "${1}"; fileinto :create "Tagged/${detail}"; stop; }
So, if the detail portion of the TO address exists, set a variable "detail" to be the first-letter-uppercased version of that portion (test -> Test, TEST -> Test and so on) and file the message into "Tagged/Test", creating that if necessary.
On Fri, Jul 26, 2013 at 10:04:22AM +0100, Darac Marjal wrote:
On Thu, Jul 25, 2013 at 11:29:56AM -0500, /dev/rob0 wrote:
We're using sieve with LMTP. We want to have lda_mailbox_autocreate and lmtp_save_to_detail_mailbox. Is there a way to make the "detail" case-insensitive? If so I have not found it yet.
I suppose we could lowercase the input string for the SQL userdb query, but that's not what is wanted. The idea being that if a user makes a mailbox called "Test" is that user+test@example.com and user+TEST@example.com should both go to that "Test" mailbox. If it was lowercased, a mailbox called "Test" would be ignored and "test" used.
With autocreate, this could be a problem if mail is delivered to autocreated case-sensitive mailboxes that the user won't see.
Hmmm, maybe a global sieve script?
I use the following sieve snippet rather than lmtp_save_to_detail_mailbox:
if envelope :detail :regex "to" "(.+)" { set :upperfirst :lower "detail" "${1}"; fileinto :create "Tagged/${detail}"; stop; }
Aha! On further examination I found a similar example here:
http://wiki2.dovecot.org/Pigeonhole/Sieve/Examples#Plus_Addressed_mail_filte...
I will need to tweak this a bit more, because we want to allow the user to create a mailbox as s/he wants, whether all CAPS, all lowercase, or Title Case (as our default setting would create a new folder if it wasn't found.) But you've surely set me on the right track here! Thank you!
So, if the detail portion of the TO address exists, set a variable "detail" to be the first-letter-uppercased version of that portion (test -> Test, TEST -> Test and so on) and file the message into "Tagged/Test", creating that if necessary.
http://rob0.nodns4.us/ -- system administration and consulting Offlist GMX mail is seen only if "/dev/rob0" is in the Subject:
participants (4)
-
/dev/rob0
-
Darac Marjal
-
Steffen Kaiser
-
Timo Sirainen