Hi, I just want some clarification on how Dovecot's IMAP assigns UIDs when it picks files from the "new" directory of a Maildir. What I am observing is that only ctime has a role to play in it. For example if there are two files in "new", a.msg & z.msg. Even when a.msg has lower mtime than z.msg and "a" comes before "z" alphabetically, dovecot will assign z.msg a lower UID if its ctime is lower than a.msg. Is this correct? Secondly, when mails are placed into Maildir through a external mechanism by-passing LDA, by any means is it possible for IMAP to run seive on it when it migrates the files from new to cur and indexes them? I understand that this might not be a valid question as mail is delivered already so there is nothing to filter :-) -Akash
On 17 Oct 2015, at 10:24, Akash <akbwiz+dovecot at gmail.com> wrote:> > Hi, > > I just want some clarification on how Dovecot's IMAP assigns UIDs when it picks files from the "new" directory of a Maildir. What I am observing is that only ctime has a role to play in it. For example if there are two files in "new", a.msg & z.msg. Even when a.msg has lower mtime than z.msg and "a" comes before "z" alphabetically, dovecot will assign z.msg a lower UID if its ctime is lower than a.msg. Is this correct?Dovecot doesn't look at the new files' mtimes or ctimes, because that would require stat()ing the file, which slows it down. So it's using the timestamp in the Maildir filename itself.> Secondly, when mails are placed into Maildir through a external mechanism by-passing LDA, by any means is it possible for IMAP to run seive on it when it migrates the files from new to cur and indexes them? I understand that this might not be a valid question as mail is delivered already so there is nothing to filter :-)Not easily. There is http://wiki2.dovecot.org/HowTo/RefilterMail
> Dovecot doesn't look at the new files' mtimes or ctimes, because that > would require stat()ing the file, which slows it down. So it's using > the timestamp in the Maildir filename itself.Thanks Timo for the clarification. Whats Dovecot's strategy when the file-name does not contain a time-stamp and its just a sequential long number such as 1494829006737776656. My problem is that I am manually copying a lot of mail into the "new" directory of a Maildir. The file names range from: 1280369043768241070 - 1514890738113019895 but Dovecot is always assigning first UID to the mail in the file 1494829006737776656. And I am failing to understand why. I tried this 3-4 times using different ways. First by simply hard linking the files into "new" dir, second by copying them over, third by copying and then touching the file in a way that lower in sequence has a lower mtime, fourth by copying them into "new" in proper ascending sequence (according to file name) and then giving them appropriate mtime related to their sequence. But no matter what i do, Dovecot assigns first UID to file 1494829006737776656 only. -Akash