Dovecot mail_location

The /etc/dovecot/dovecot.conf file includes:-

mail_location = maildir:/var/spool/imap/dovecot/mail/%u

%u is a variable that represents the user's name. But, as explained in the 10.6 Mail documentation, the final folders are NOT the user's name, but in fact their GUID, a long alpha numeric string.

Can someone explain HOW this is being set? Why are the folders not using the users' names? Is there a setting somewhere I cannot find that says %u should be the GUID and not the username?

I'm trying to recover some mail here and I need to understand things before I can figure out how to do it, so would appreciate some assistance with this.

Thanks.

MacPro, MacBook Pro, XServe, iPhone 3G, Mac OS X (10.6), 30" HD display,

Posted on Nov 16, 2009 8:02 AM

Reply
7 replies

Nov 16, 2009 9:07 AM in response to William Bowden1

Thanks, but a bit tricky as my email system is down while I work it all out.

As per my other post, I upgraded the server from Leopard to Snow L. Email doesn't work, seems that Mail and Dovecot are not playing well with my (legacy) settings that worked ok for Cyrus. So I'm looking into manipulating the mail storage at both tends to try and effect a cure. In the meantime, I'd like to use LAYOUT-fs so Dovecot will store messages in a folder hierarchy instead of the default single flat level. Ok, I can do that by adding it to dovecot.conf, but Server Admin controls dovecot.conf and if I add :LAYOUT=fs to the end of the mail_location string, it then adds /%u onto the end in dovecot.conf, but which is hidden by Server Admin. In any case, this is of course wrong as :LAYOUT=fs has to follow the path.

Then I could not actually remember seeing %u at the end of the original mail_location string in dovecot.conf. was it there all along?

I then became puzzled by the fact that %u represents the username, but the actual user's folders within the main path specified in mail_location did not have the name of the user. Instead their name is the GUID of the user (owned by that user so you can still see whose folder it is) and this is as described in Apple's server docs for 10.6 Mail Service.

So on the one hand we have the location being specified with the username, but the folders get created as the GUID and I just don't see how or why. Is there another setting somewhere that states %u should be the GUID and not the name? If so, I haven't found it.

It also leaves me with the problem that you CANNOT customise the mail_location setting in dovecot.conf, because Server Admin just stupidly rewrites it and gets it wrong. But why is Apple's dovecot using GUID and not the username?

Nov 16, 2009 9:21 AM in response to UKenGB

Ok do you still have the old cyrus imap store?
regardles yes dovecot uses GUID for username to see your users GUID simply
copy and paste this into terminal

/usr/bin/dscl /LDAPv3/127.0.0.1 -list /Users GeneratedUID

principle is and important factor Dovecot is really kind but permissions must be correct the folder concerned must have the user GUID as owner and mail as the group that includes all inside it.

if you have the old imap store
download cyrus2dovecot.sh and run that after making sure the paths concerned are correct at top of the file. once run you will fine your mailboxes in /tmp/dovecot/etc you will
once this far let me know

Nov 16, 2009 11:08 AM in response to William Bowden1

The problem was that the IMAP prefix was originally set to "~". This was from when I was using a linux server and wanted mail stored in the home folder. Cyrus however seems to deal with the "~" differently, but was happy to work with it as just a regular character, so mail was no longer in the user's home folder, which now suited me better so I didn't look into it any further.

However, upgrading to Snow Leopard Server and Dovecot meant that all the mail folders were stored by Dovecot as ".~.whatever.thefolder.nameis", including e.g. ".~.Drafts". On first starting Mail on the client after the upgrade, the mail all appeared to be there, but there was obviously a problem and I concluded was that although Cyrus could deal with the "~", Dovecot could not.

So, I moved all the local mail up one level out of the "~" folder and threw that folder away. Then I renamed all the Dovecot mail folders to remove the ".~" at the beginning. Reset the client's Mail IMAP path to empty and started the Mail Service on the server. After some activity all the mail is there and accessible, so it basically worked and I'm no longer stuck with that spurious "~" IMAP path prefix. However, many messages are now showing as unread, although not all which is bizarre, but relatively easy to fix, if a bit tedious.

So all I'm left with now is the %u - GUID puzzle.

I understand what the GUID is and that they might want to use that instead of the username, but what I cannot understand is that the dovecot.conf file explicitly states mail_location as /var/spool/imap/dovecot/mail/%u, but the actual folders it creates and uses are /var/spool/imap/dovecot/mail/GUID. So what is telling it to do something different from its own conf file? Where is the configuration parameter that says "use GUID and NOT the username"? That's what I don't get.

Nov 17, 2009 7:40 AM in response to William Bowden1

Indeed, unless you're using LAYOUT=fs, but it seems to be impossible in Apple's implementation. But that's not the problem.

What I am still trying to understand is that the dovecot.conf file specifies using %u (which is the username according to all the docs I've found), but the folders get created named as the GUID. So where is the configuration that says use GUID and NOT the username?

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Dovecot mail_location

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.