Synchronizing Kerio Connect mail folders for off-line use


2012/03/20



While browsing the Kerio Forum I came across an odd request that had been ignored for almost a week. I wasn't sure of exactly what was wanted, and perhaps that is why no one else had answered, but I took a shot and pointed him at my mailbox split-up script for Kerio.

Nope, that wasn't what he wanted. What he wanted was a local .PST file (local to a user's computer) that would contain the emails of a particular mailbox folder - in this case, emails relating to a specific construction project.

I presume that the reason for this is to allow local access and possibly search. What this requires is full folder synchronization - that is, downloading everything locally, not just header information. Mail clients vary in their capabilities in that area.

I tested all this using a fake "ralph" account with various clients. I used Kerio Webmail to create a MyArchive folder and moved messages to that before creating the accounts.

Poor Ralph has been associated with my company for a long, long time. He's often had email accounts, though they usually are quickly deleted soon after their creation. Ralph has never drawn a paycheck (though he never has done any work, either, so I suppose that's fair).

Microsoft Outlook

You can't do that with POP, because POP only handles one folder - the INBOX. The only way you could do that with POP is to make sure everything was left in the INBOX at least long enough for Outlook to download it and apply rules to move messages somewhere else. To avoid interfering with other usage, you'd want to be sure to set POP to leave mail on the server.

If that can't be done, IMAP would be another choice, though you do need a version of Outlook that will allow full download of messages, not just headers AND allow you to select you want that to apply to. I don't think anything before Outlook 2007 can do that (please correct me if I am wrong).

The KOC (Kerio Outlook Connector - this is the free Outlook plugin that basically makes Outlook think it is talking to an Exchange server) has the needed features. As described at the Online/Offline mode, you can select folders to be fully synchronized for off-line viewing.

Setting folder synchronization

You are still going to have copy or move the folder (or more likely, export it to a .pst file for Outlook) if you want to delete it from the server later. That will be a local action, so won't be slowed down by dragging stuff down from the Internet. After it has been safely exported, you can delete from the server.

Apple Mail

Apple Mail is a great example of poor synchronization features. It can indeed download full IMAP folders (or see Kerio as an Exchange server), but you don't get to select or deselect which folders. It does have an easy export function, but a very large mailbox could take some time. On the other hand, these are simple text files with a little bit of extra XML, so you could just move them somewhere else for safety. Finder will happily open a .emlx file with Mail.app if you ask it to.

Ralph in Kerio Webmail
Ralph's message in Kerio Webmail
Apple Mail Preferences account setting

Microsoft Entourage

I only have the cheap version of Entourage, so wasn't able to see how it worked with Kerio as an Exchange account, but for IMAP, it suffers the same limitations as Apple mail. You can tell it to download everything, but that will be the case for each synchronized folder - not options as there are in Outlook.

Local Search

In [email protected][email protected]s/58.emlx we find:

1399      
Return-Path: <[email protected]>
X-Footer: YXBsYXdyZW5jZS5jb20=
Received: from localhost ([127.0.0.1])
	by mail.aplawrence.com
	for [email protected];
	Mon, 19 Mar 2012 14:36:49 -0400
From: [email protected]
Subject: Testerooni
To: [email protected]
Message-ID: <[email protected]>
Date: Mon, 19 Mar 2012 14:36:49 -0400
X-User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.11 (KHTML,
	like Gecko) Chrome/17.0.963.79 Safari/535.11
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="-----------9d83245ea1fe5832c271b08bf48adc17"

This is a multi-part message in MIME format.

-------------9d83245ea1fe5832c271b08bf48adc17
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

We need a unique phrase to have any hope of finding this mail.




-------------9d83245ea1fe5832c271b08bf48adc17
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html;chars=
et=3Dus-ascii">
<style>BODY{font:10pt Tahoma,Verdana,sans-serif} .MsoNormal{line-height:=
120%;margin:0}</style></head><body>
We need a unique phrase to have any hope of finding this mail.<div><br><=
/div><div><br></div></body></html>
-------------9d83245ea1fe5832c271b08bf48adc17--
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>date-sent</key>
	<real>1332182209</real>
	<key>flags</key>
	<integer>8623750145</integer>
	<key>original-mailbox</key>
	<string>imap:[email protected]/Myarchive</string>
	<key>remote-id</key>
	<string>1</string>
	<key>subject</key>
	<string>Testerooni</string>
</dict>
</plist>
 

Notice the extra XML data appended. If you move or copy this file elsewhere, double-clipping on it in Finder will still cause Mail to happily open and display it. The actual message at Kerio Connect mail server looks like this:

        Return-Path: <[email protected]>
X-Footer: YXBsYXdyZW5jZS5jb20=
Received: from localhost ([127.0.0.1])
        by mail.aplawrence.com
        for [email protected];
        Mon, 19 Mar 2012 14:36:49 -0400
From: [email protected]
Subject: Testerooni
To: [email protected]
Message-ID: <[email protected]>
Date: Mon, 19 Mar 2012 14:36:49 -0400
X-User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.11 
(KHTML,
        like Gecko) Chrome/17.0.963.79 Safari/535.11
MIME-Version: 1.0
Content-Type: multipart/alternative;
        boundary="-----------9d83245ea1fe5832c271b08bf48adc17"

This is a multi-part message in MIME format.

-------------9d83245ea1fe5832c271b08bf48adc17
Content-Type: text/plain;
        charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html;chars=
et=3Dus-ascii">
<style>BODY{font:10pt Tahoma,Verdana,sans-serif} .MsoNormal{line-height:=
120%;margin:0}</style></head><body>
We need a unique phrase to have any hope of finding this mail.<div><br><=
/div><div><br></div></body></html>
-------------9d83245ea1fe5832c271b08bf48adc17--
 

If you export to "mbox" format (right click on a Mail folder and choose "Export"), that file can also be opened, though by default it opens in Text Edit - Mail would treat it as an attachment in that form.

If the intent behind all of this is local search, note that Spotlight will take a small amount of time to index these things and will only notice what it wants to notice. On the other hand, "grep" in a Terminal window will find everything (though at a slower pace):

$ grep -lr "We need a unique phrase to have any hope of finding this mail" . 2>/dev/null
./.viminfo
./59.emlx
./Documents/inprogress
./Documents/Myarchive.mbox/mbox
./Library/Containers/com.apple.Preview/Data/Library/Mail/V2/IMAP-r[email protected]/Deleted Items.mbox/Myarchive.mbox/6FB5A603-3E68-4157-B595-9AE92ADDC287/Data/Messages/63.emlx
./Library/Containers/com.apple.Preview/Data/Library/Mail/V2/IMAP-r[email protected]/Sent Items.mbox/6FB5A603-3E68-4157-B595-9AE92ADDC287/Data/Messages/59.emlx
./Library/Containers/com.apple.Preview/Data/Library/Mail/V2/MailData/Envelope Index-wal
./Library/Containers/com.apple.TextEdit/Data/Library/Mail/V2/IMAP-[email protected]/Deleted Items.mbox/Myarchive.mbox/6FB5A603-3E68-4157-B595-9AE92ADDC287/Data/Messages/63.emlx
./Library/Containers/com.apple.TextEdit/Data/Library/Mail/V2/IMAP-[email protected]/Sent Items.mbox/6FB5A603-3E68-4157-B595-9AE92ADDC287/Data/Messages/59.emlx
./Library/Containers/com.apple.TextEdit/Data/Library/Mail/V2/MailData/Envelope Index-wal
.[email protected]/Deleted Items.mbox/Myarchive.mbox/6FB5A603-3E68-4157-B595-9AE92ADDC287/Data/Messages/63.emlx
.[email protected]/Sent Items.mbox/6FB5A603-3E68-4157-B595-9AE92ADDC287/Data/Messages/59.emlx
./Library/Mail/V2/MailData/Envelope Index-wal
 

That took a long time to run. Spotlight, on the other hand, very quickly found almost nothing.

Spotlight finds very little very quickly



Got something to add? Send me email.





(OLDER) <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> Synchronizing Kerio Connect mail folders for off-line use




Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Anthony Lawrence



Kerio Connect Mailserver

Kerio Samepage

Kerio Control Firewall

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us





Anyone who slaps a 'this page is best viewed with Browser X' label on a Web page appears to be yearning for the bad old days, before the Web, when you had very little chance of reading a document written on another computer, another word processor, or another network. (Tim Berners-Lee)

Being able to break security doesn’t make you a hacker anymore than being able to hotwire cars makes you an automotive engineer. (Eric Raymond)








This post tagged: