Educational ICT Virtualisation Specialist

Twitter LinkedIn E-mail
Precedence Technologies Ltd
Technology House, 36a Union Lane
Cambridge, CB4 1QB, United Kingdom
T: +44 (0)8456 446 800 / +44 (0)1223 359900
F: +44 (0)8456 446 899 / +44 (0)1223 359459
E: enquiries@precedence.co.uk
Email-RootPath

Jump To: Support > KB > NetManager > Email > RootPath

Email IMAP root path

NetManager has been around a long time and many features and improvements have been introduced. When new features come along, we need to ensure that existing installations are not adversely affected. Unfortunately, this means that some existing systems are not set up in the same way a new system would be and so are missing out on some benefits. A prime example is the location of users' email which is described in this page.

History and information

In 1997 when it first started, NetManager used the University of Washington IMAP server (UW IMAP). UW IMAP counts all mail folders for a user (except for INBOX) as being relative to the top level of that user's home area. So by default, if you create a mail folder called MyFolder this will be stored as a single file called MyFolder in the very top of your home area. Of course, people use their home areas for various things, notably storing general file such as images and documents. If left to its own devices, UW IMAP will think that all such files are mail folders even all those in sub-directories. For example, if you had a directory called Music with a thousand MP3s in it, your email client would try to present all of these MP3s as separate mail folders. This is clearly a bad idea.

To work around this limitation, it is conventional to store all mail folders in a subdirectory called mail in your home area so that that all email is stored in one place and not mixed up with regular files. Programs such as pine enforce this by default. The standard WebMail client does the same by adding mail/ to the start of the folder path, i.e. what you see as MyFolder is in fact mail/MyFolder. This all works well until you try to use a different mail client (such as Thunderbird or Outlook) which isn't aware of this. Most clients do allow you to set the IMAP root path, though they often use different names. For instance, Thunderbird calls it the IMAP server path. Once set everything should be consistent. Unfortunately, setting the IMAP root path is easily forgotten as it is an extra manual step and this is downright inconvenient if you are using autoconfiguration/autodiscovery. If you use multiple email clients and one is using a root path and another is not, you will end up with folders visible in one, but not the other.

Nowaways, NetManager uses Dovecot as the IMAP server. Dovecot allows you to configure where it looks for mail folders (in UW IMAP it was fixed to the top of the home area) and, ideally, this should be set to mail. Unfortunately, if this is enabled by default and you already have an IMAP root path set in your mail client, it would end up doubling up and looking in mail/mail so it would appear as though all your mail folders had disappeared. Similarly, if you don't have an ''IMAP root path' set, your mail will be at the top level, not in mail, so once again it would appear as though all your mail folders had disappeared. Therefore, to maintain backward compatibility, we cannot set the mail folder location to mail by default.

Migration

As described above, ideally you do not want to have an IMAP root path set as it interferes with auto-configuration. Also, to take advantage of new features such as Shared Mailboxes and Public folders, you must not have an IMAP root path set.

Ideally, you should configure Dovecot to look in mail at the same time as you remove the IMAP root path from all your mail clients. For the record, NetManager WebMail automatically deals with this. To make the matter more complex, if users have been using a client without the IMAP root path set, their mail folders will not be in the mail directory and will need moving. We have a number of tools to ease the migration.

Steps:

  1. Ensure dovecot is enabled with imap_server="dovecot" in your NetManager configuration file
  2. Set imap_folderpath="mail" in your NetManager configuration file
  3. Run build_server to make the changes live
  4. Run mailmove to move mail folders from the top level into the mail subdirectory for all users
  5. Run subscribeall -a to ensure that all mail folders are subscribed to and thus visible in the mail client
  6. Go round all email clients removing the IMAP root path. You may want to warn users prior to starting that their mail folders may appear to go missing temporarily.

Tools

mailmove

mailmove will go through all files in the top of every user's home directory and check whether they are mail folders or not. If they are mail folders, the file will be moved into the mail subdirectory. If there is a folder with same name already there (e.g. MyFolder and mail/MyFolder), it will be renamed by having -1 added to the end (e.g. mail/MyFolder and mail/MyFolder-1).

Should be run after imap_folderpath is set (so it knows where to move the mail to). If not set, it will report No mail to move as imap_folderpath is not set. If you want to run it beforehand, you'll need to specify the sub-directory to use. Example run:

netmanager 1# mailmove mail
/usr/export/home/sborrill/Drafts -> /usr/export/home/sborrill/mail/Drafts
/usr/export/home/sborrill/Sent Items -> /usr/export/home/sborrill/mail/Sent Items
subscribeall

subscribeall finds all mailboxes for each user and ensure that they are subscribed to. Use subscribeall -a to do this for all users.

Syntax: subscribeall [-afhv] [<groupnames> ...]
        -a = Create subscriptions file for all users
             (otherwise just listed groups
        -h = this message
        -v = be verbose
© Copyright Precedence Technologies 1999-2017
Page last modified on March 03, 2017, at 12:30 PM by sborrill