Outlook 2013/2010 nightmare #2

David.M.Clark david at davrom.com
Mon Mar 9 23:48:33 UTC 2015


Hi All and my sincere thanks to Jakob and Joseph for your responses.

I got around the nightmare for this site but it is far from satisfactory 
and given both Thunderbird, Roundcube and the Android e-mail client work 
perfectly as expected, this following links comments enforce what I 
experienced over the weekend:

http://comments.gmane.org/gmane.mail.imap.dovecot/79231

I have not struck this for other sites using Outlook 2013 (though I 
continually banter that Outlook version 'anything' is designed for MS 
Exchange and nothing else), but then again I have not had Outlook 
needing to share the same e-mail accounts across PCs.

So the bottom line for this particular site is:

Set the "Root Folder" for IMAP in outlook to "mail". This is messy from 
my beloved Linux command line perspective in that you end up with 
${HOME}/login_name/mail/mail. But it does work and stops the Outlook 
crashes.

If you set it to the Outlook recommended "INBOX" or "Inbox", you can't 
see or access subfolders.

Now here comes the ugly part of Outlook 2013 using IMAP to Linux (at 
least for this site):

If you want to share a single e-mail account across multiple PCs running 
Outlook 2013, you _cannot_ use the "Root Folder" of "mail" as I have 
indicated above. The workaround is to create each subsequent PC with a 
"mail2", "mail3" etc folder (without the quote marks of course). If you 
set up two PCs with the same Root Folder, the new PC crashes out of 
Outlook and eventually so does the original PC. The only way around this 
is to delete the identity and PST files in Outlook and strictly set them 
up again to different "mail" something folders. Almost reminds me of the 
old MS "Share Violation" issue :-)

So after the user is set to the mail2/mail3 folder and it appears under 
the user's original "mail" folder, you then have to blow away the 
mail2/mail3 folder and then do a symbolic link to the mail folder:

ln -s mail mail2

In this way, both users on the PCs will be seeing the same IMAP folders, 
being mail and mail2 on two different PCs. Naturally to add a third PC 
to this would be "mail3" etc.

Now the other ugly part of this is you also need to update their 
.subscriptions file in ${HOME}/login_name/mail to show folders like:

mail/Sent Items
mail/Junk E-mails
mail2/Sent Items
mail2/Junk E-mails

Given you would need to manually do this above, and is just not 
suitable, I have written two scripts to automate this process  and it 
works cleanly so far.

The first script does the automatic removal of the mail2/mail3 etc 
directory and creates the symbolic link, the second script is used to 
redo the .subscriptions file if the contents of the 'mail' directory change.

You may need to mod these but I have a cron running as root to do this.

Script 1 (mail_root_enforce):

=----------------------------------------------------------------------------------=
COMPLETE_HOME=/u/home
cd ${COMPLETE_HOME}

for USERHOME in *
do
    ls -d ${USERHOME}/mail/mail? | while read CHECKME
    do
      JUST_CHECKME=`basename ${CHECKME}`
      if [ -d ${CHECKME} -a -L ${CHECKME} ]
      then
          #echo "${CHECKME} is ok"
          :
      else
          echo "${CHECKME} is _not_ ok"
          cd ${USERHOME}/mail
          rm -rf ${COMPLETE_HOME}/${CHECKME}
          ln -s mail ${JUST_CHECKME}
      fi
    done
    cd ${COMPLETE_HOME}
done
=----------------------------------------------------------------------------------=

Script 2 (mail_multi_users):

=----------------------------------------------------------------------------------=
cd /u/home

for THIS_USER in *
do
   MORE_THAN_1=`ls -d ${THIS_USER}/mail/mail* | wc -l`
   if [ "${MORE_THAN_1}" -gt "1" ]
   then
       # echo "${THIS_USER} has more than one"
       ls ${THIS_USER}/mail/mail >${THIS_USER}/subcount
       if [ ! -f ${THIS_USER}/subcount_last ]
       then
           >${THIS_USER}/subcount_last
       fi
       ISDIFF=`diff ${THIS_USER}/subcount ${THIS_USER}/subcount_last | 
wc -l | awk '{print $1}'`
       if [ "${ISDIFF}" -gt "0" ]
       then
           # echo "Is Different"
           ls ${THIS_USER}/mail/mail >${THIS_USER}/subscription_tmp
           >${THIS_USER}/subscription_new
           for ROOT_MAIL_DIR in ${THIS_USER}/mail/mail*
           do
             MAIL_BASE_NAME=`basename ${ROOT_MAIL_DIR}`
             cat ${THIS_USER}/subscription_tmp | sed 
"s:^:$MAIL_BASE_NAME/:g" >>${THIS_USER}/subscription_new
           done
           cp ${THIS_USER}/subscription_new ${THIS_USER}/mail/.subscriptions
           chown ${THIS_USER}:popusers ${THIS_USER}/mail/.subscriptions
           cp ${THIS_USER}/subcount ${THIS_USER}/subcount_last
       fi
   fi
done
=----------------------------------------------------------------------------------=

You will note the ${HOME} directories are all under /u/home so if you do 
sadly need to use these scripts, please change the /u/home to suite the 
${HOME} location set on your server. I prefer to run this as root to 
enforce things and not have any funny permission errors, and also to 
save needing to run multiple instances for multiples users.

One annoying caveat that the site will have to get used to: the mail2, 
mail3 folders do show up when using good e-mail clients like 
Thunderbird, SOGo, Roundcube or Android e-mail client. This is because 
they are seeing the contents of the .subscriptions file. I haven't 
looked into Dovecot doco for possible multiple .subscription files to 
make the folders bit look 'nicer'. I will look at something like 
'namespace' to see if this might help. Please bear in mind this was in 
an emergency to get things at least 'working' so the users were happy 
when they hit the office on Monday.

A documented story for your perusal and use if you are 'stuck' like I 
was. I will continue to try and see if there is a more elegant 
work-around but for now, this is all I can come up with.

PS: I notice everyone suppresses their e-mail footer so doing the same 
here :-)

-- 

As always, I remain at your service.

Kindest Regards,
David.M.Clark


More information about the dovecot mailing list