HomeBanner

Sharing the same Mailboxes

How can I make aplications hare the same mailboxes ?

Carlos Robinson

Ok, the main trick is that many mail programs use the same basic format: the unix mail folder format, or mbox. They may store it on different directories, but they can be changed or symlinked. Some need special extensions for the names for the subfolders, but again, they can be symlinked. Unfortunately, there is no agreement on how to store flags like read or new message, or indexes.

Warning

IMPORTANT: Before trying any of the above, backup all your mail folders. No excuses :-)

Ok, to the method. You have to decide which program is "boss"; ie, the directory structure to use, and also who is responsible for fetching /and or sending mail. In my case, my main program is Pine, and the posting is handled by sendmail, fetchmail, and procmail, ie, externally to any mail client program.

So, my mail folders are in "/home/myuser/Mail", and subfolders are just directories. Lets assume the folder "folder", and a subfolder "subfolder". I'll have this structure:

/home/myuser/Mail/			directory
/home/myuser/Mail/folder         	mbox file
/home/myuser/Mail/subfolder/     	directory
/home/myuser/Mail/subfolder/folder      another mbox file
      

Netscape / Mozilla

Netscape can see normal mbox files without problems, but it will create an index file of the same name with an .msf extension (some times it has to be manually created).However, it will not see subfolders unless they have a .sbd extension, and there is an mbox file named the same as the subfolder as well.

You can use the same "/home/myuser/Mail/" tree, or create a new one, like "/home/myuser/Mail.mzla", holdings symlinks to all the folders from "~/Mail/" you want to see. I prefer the later, it's makes things better for pine, but it's more work to setup the first time (I use a script).In any case, you need to go to the menu "Edit/Mail and Newsgroups Accounts Settings". There, find the settings for "Local Folders/Local directory" and adjust acordingly to your choice.

If it is a new directory, then
   for each original mbox file do
     create a new simlink to it
    

{sometimes optional step: create empty index file}

For each mbox file (or symlink to one) in the directory
   create an empty file with extension ".msf" with touch (ex: folder.msf)
    
For each subfolder
    Create file "/home/myuser/Mail/subfolder.msf" with touch
    Create file "/home/myuser/Mail/subfolder" with touch
    Create symbolic link "home/myuser/Mail/subfolder.sbd" to the folder
    

Repeat the above for each sub-sub-folder.

Quit and restart netscape, and check what it sees and what it doesn't see. Redo, etc, for ever - this is linux ;-)

Special files, created or used by Netscape: Sent, Templates, Trash, Unsent Messages, outbox, Inbox (?). Some can be configured, otherwise simlinked; but they have got to have those precise names.

So, you will have something like this, or similar (there are many combinations, mine is more complicated):

~/Mail/
~/Mail/mbox
~/Mail/folder/
~/Mail/folder/mbox

~/Mail/mbox.msf          (0 bytes)
~/Mail/folder.sbd        --> ~/Mail/folder/
~/Mail/folder            (0 bytes)
~/Mail/folder.msf        (0 bytes)
~/Mail/folder/mbox.msf   (0 bytes)
    

Netscape / Mozilla for windows

This is an special case. It uses the same files as the linux version, but of course, it can not read linux partitions: thus, the windows version has to be the boss, and the linux version be configured to use the local files in the windows partitions. Otherwise, just symlink as needed.

Example. The windows mozilla folders will be in some place like this:

/windows/C/windows/Profiles/Cer/Application/Data/Mozilla/Profiles/default/l4mvabd3.slt/Mail/tiscali.es/Inbox
/windows/C/windows/Profiles/Cer/Application/Data/Mozilla/Profiles/default/l4mvabd3.slt/Mail/LocalFolders/Drafts
    

Then, if I am interested in just reading the windows folders in linux, but not otherwise, I could do:

cd Mail.mzla  (or whatever)
ln -s WindowsFolder LinuxFolder
ln -s WindowsFolder.msf LinuxFolder.msf
      

If I want to read/write in any of them, I'd have to symlink the main mozilla directory, which ever it is (somewhere in .mozilla/, for example ".mozilla/cer/txr7hrr6.slt/Mail/"), to the windows one in the fat partition. Security is impaired, though (FAT is world readable).

Warning

Restriction: if you use NTFS in windows, you can not write to it from linux.

Eudora for windows

I don't have it, but as it uses the same mbox format (as Ole Kofoed pointed here), the folders can be, at least, read in linux. I don't have details.

Kmail

Im not sure if kmail ask the first time it runs where it should store the folders, but I have been unable to find that in the configuration file. Perhaps it always uses ~/Mail. Otherwise... :-?

Kmail can see mbox files directly, and it will create its own indexes:

 mbox              (original mailbox file)
 .mbox.index
 .mbox.index.sorted
    

But it can not see the subfolders: we have to jump over some more loops ;-) Fortunately, this one was documented in kmail help: just create a symlink to the subdirectory with the extension ".directory". Also, if I remember correctly, it needs an empty new mbox file of the same name as the directory. For example:

lists/                (original folder)
._klists.directory     -> lists/
._klists               (empty file)
._klists.index
 ._klists.index.sorted
    

You do not need to create the indexes (which are hidden, that's very nice of the designers).

balsa

It uses the same format as Pine, so it is transparent. It even uses the same system for marking new/read/unread emails (an specially formated mail in the mbox file)

Evolution

Unusable. It doesn't cooperate, it wants to be left alone. :-(

It can read a mbox file, true. But if it is a symlink to an existing file, on exit that symlink is replaced by a real new file, which is a copy of the original one. That means changes made by the other programs will not bee seen by evolution, and viceversa. Very unfortunate :-(

mutt

I don't use it, I don't know.

pine

Highly configurable, uses standard mbox files and folders, with no external indexes. Will try to read *any* file in the asigned directory and all subdirectories of it, including indexes: that's why I use a different folder for mozilla, containing symlinks to the folders pine uses, and mozilla own indexes.

Well, those are my notes. I'm sure there will be errors, but I hope they are not important. If something is unclear, just ask: but don't be on a hurry O:-)


Updated: Tue, 03 Feb 2004
Valid CSS!Valid HTML 4.01!