[Dovecot] UID order vs date order

Torbjorn Jansson torbjorn.jansson at mbox200.swipnet.se
Wed Nov 20 08:56:15 EET 2013


On 2013-11-17 19:27, LuKreme wrote:
>
> On 17 Nov 2013, at 03:20 , Torbjorn Jansson <torbjorn.jansson at mbox200.swipnet.se> wrote:
>
>> Hi
>>
>> i have recently moved a mailbox to dovecot and intend to use it via imap and i have run into a problem.
>>
>> when i imported the mails apparently the UID order got reversed compared to the date order, result is that some clients like on android devices download the oldest mails instead of newest.
>> it is not so interesting to have several years old mail show up at the top of the mailbox.
>>
>> is there any way of convincing dovecot to renumber the mails by date order instead?
>
> Probably the easiest solution is to figure out what you did in the import to cause this and reimport the mails. Short of that, the only thing you can do (assuming you are using Maildir, right?) is to get the date out of the mail and rewrite the filename with the correct epoch timestamp.
>
> It would be great if there was a way to use doveadm to do this, but short of that you just have to fix it yourself. The good news is, with gnu date it’s pretty simple.
>
>   $ date --date='2013-11-17 01:23:45 +0700' +%s
> 1384626225
>   $ gdate --date='November 17, 2013 01:23:45 +0700' +%s
> 1384626225
>   $ gdate --date='17 Nov 2013 01:23:45 +0700' +%s
> 1384626225
>
>> i cant be the only one that have run into this.
>
> I had a similar problem, but I ignored it and as new mail came in, the problem went away (mostly) on its own. :/
>

i have fixed the problem.
initially during my testing i did try the outlook import to imap folder 
and it worked but for some reason it aborted half way thru, probably due 
to some badly formed mail from many years ago so i chose not to use 
outlook for the conversion.

but i had to use outlook anyway and what i did was to copy one folder at 
a time via outlook from the local pst to imap folder, some folders i 
lost a few mails but not many.
end result is that i have a good mailbox now.

to sum it up:

Tbird import
works, no problem with character sets but screws up the order of the mails.

Outlook import
works but more likely to stop on bad mails, some character set issues (a 
few mails ended up with ??? in the sender instead of the right name) and 
sort order is correct.



i did run into another issue and that was with android email client, it 
decided to use up all 10 simultaneous connections and then displayed an 
error.
had to increase the connection limit several times and at one point the 
client used 65 connections at the same time.
compare this with tbird that uses only 5.
but i believe this is a known issue.



More information about the dovecot mailing list