Daniel
Naber

    daniel.naber@t-online.de

David
Rugge

    davidrugge@mediaone.net

2002-10-03
1.5

# Using other Mailbox Files with &kmail;

&kmail; offers an import tool for the messages and address books of some other email clients. You can access it using Tools Import.... Please make sure that you compact your folders in the other email client, no matter if you are going to use the import utility or if you are going to copy files manually. You only need to read this chapter if this tool does not work for you.

This section is for all of the users who need to move email messages from their previous email client over to &kmail;. &kmail; can store its messages using mbox or maildir formats, which are the most widely used mailbox formats on &UNIX; systems. Mbox mailboxes store messages in one file, identifying where messages start and end with a `From` line (do not mix this up with the `From:` header that contains the message's sender). Maildir uses one file per message. For many &UNIX; email clients, all you must do is move your mailboxes to `~/Mail` (or make `Mail` a symbolic link to the folder containing your mailboxes), make sure they are writable by your user, and launch &kmail;. The mailboxes should now show up correctly in &kmail;.

Please have a look at the Tools section of &kmail;'s homepage first, to see if there is a tool that imports your mailbox and maybe even address book.

Do not use a second email client that accesses the files in `~/Mail` while &kmail; is running or you might lose messages. This section only explains how to import mailboxes to &kmail; once, it is not useful to you if you're planning to use several email clients for your mailboxes in the future.

Eudora Lite/Eudora Pro

  Eudora uses the mbox format in its mail files. To use them with &kmail;, make sure that your Eudora mailboxes have been compacted, then copy the `.mbx` files (&Windows; Eudora) or Eudora mailbox files (&Mac; Eudora) to your `~/Mail` directory. You do not need to copy the `index` files. Once you start &kmail;, the mailboxes should appear in the Folders pane and the messages should be accessible in the Headers pane.

  If messages do not appear in the Headers pane, your mailbox files may still contain &Windows; or &Mac; line feed characters. Use your favorite text editor, the recode command or a scripting language to change the &Windows; or &Mac; line feeds to &UNIX; line feeds.

Mailsmith

  Mailsmith runs on &Mac; and uses its own database format, however it is possible to export mail into mbox format using File Export Mail on a selected mailbox or on selected messages. Once the messages have been exported, translate the &Mac; line breaks to &UNIX; line breaks using your favorite editor, or using the following command under &Linux;:

  ``cat` `mail-mac.txt` | perl -e 'while (<STDIN>) { s/\r/\n/gi; print $_ ;}' > mail-unix.txt`

  &kmail; will only recognize mboxes placed directly in the `~/Mail/` directory. This means that a folder hierarchy cannot be preserved by simply moving files into the `~/Mail/` folder, but will need to be reconstructed within &kmail; manually.

MMDF

  This format is close enough to the mailbox format that &kmail; should be able to use these mailboxes if you just copy them to your `~/Mail` directory. However, MMDF mailboxes have not been tested with &kmail;, so your results may vary. If you can get this format to work with &kmail;, please let us know so we can include more specific directions in the next documentation release.

MH mailboxes

  MH mailboxes are directories containing files that correspond to each message in that mailbox. A shell script to convert MH mailboxes to mbox mailboxes, `mh2kmail`, is included at least in the source releases of &kmail;, but maybe not in the packaged releases. Running this script on a MH folder will convert it to an mbox file. We strongly suggest that you back up your MH mail folders before you use this script.

Forte Agent

  In Agent:

  1. Select the messages to export

  2. Select FILE SAVE MESSAGES AS

  3. Mark the UNIX FORMAT and SAVE RAW boxes

  4. Give File a `.txt` extension and save.

  In &kde;:

  1. Move previously saves file to correct `~/Mail` folder

  2. Rename file without `.txt` extension

  When you open &kmail; the new folder with appropriate messages will be there.

&Netscape; Mail

  If you are using &Netscape; 4.x, the mail files should be found in `~/nsmail`. If you are using &Netscape; 6.x, they're buried in a directory deep in the `~/.mozilla` subdirectory, something like: `/home/user_name/.mozilla/user_name/2ts1ixha.slt/Mail/Mail/server_name` (The `2ts1ixha.slt` string will probably vary, so check it on your own system.) The `[...]/Mail/Mail` directory contains one subdirectory for each account from which you receive mail through Netscape (&eg; `[...]/Mail/Mail/math.university.edu`); you will need to copy files from each of them if you want everything to be accessible under &kmail;.

  If you have no sub folders, just copy all of the &Netscape; files to `~/Mail`, make sure that they are writable (only by your user, of course), and restart &kmail;: all of the messages will now appear in &kmail; folders. (Note that if you use a command like `cp `*` `~/Mail``, you should follow it with `rm `-f` `~/Mail/*.msf``; every &Netscape; 6 folder has a corresponding `.msf` file, and if you do not get rid of them you will have a bunch of spurious empty folders.)

  If you were using sub folders under &Netscape; (&eg; a main folder called Work with sub folders called Jim and Nancy), there are additional steps required. First, create the main folder (Work) in &kmail; and create a temporary child folder under it (by right-clicking on the folder name and selecting Create child folder); it does not matter what you call this folder -- dummy or the default unnamed, for example. Once a child folder has been requested, &kmail; creates a hidden directory in `~/Mail` called (in this example) `.Work.directory`. You can then copy your &Netscape; sub folder files (Jim and Nancy) into `~/Mail/.Work.directory`, and restart &kmail;; the child folders will appear under the main folder Work. Of course, this procedure may be extended for sub-sub folders, to any depth. (You can remove the temporary child folders afterwards, unless it amuses you to have a Work sub folder called dummy.)

Pegasus Mail

  Pegasus for win32 uses single files for Mail folders similar to &kmail;. Pegasus mail folder files have the extension `.pmm` but they are the same format as mbox except the messages do not start with the `From` header, but with a control character. To work around this, replace each instance of the control character with `From aaa@aaa Mon Jan 01 00:00:00 1997`. This `From` line should be the first line of every message, before the `Received:` and other headers. Make sure to use a text editor that lets you save the files in &UNIX; format or create new folders in Pegasus that are in &UNIX; format and copy your messages there.

Maildir / Outlook Express / xfmail

  Tools to convert these formats are available at the Tools section of &kmail;'s homepage.

Lotus Notes, BeOS Mail files, cc: Mail, &etc;...

  First you should have a look at Tools section of &kmail;'s homepage if there are tools to convert your messages.

  Mail programs not listed here or on the homepage probably do not work with &kmail; as they use proprietary mail formats that &kmail; cannot understand. However, there is no harm in trying! If the mailbox file looks similar to the mbox format, try copying the mailbox file (remember, the index file is not needed) to your `~/Mail` directory and see what happens if you start &kmail;. If you get mailboxes from your favorite email client to work in &kmail;, please tell us how you did it so that we can include directions in a future revision of this documentation.

## Section Authors

This section written by: Daniel Naber daniel.naber@t-online.de and David Rugge davidrugge@mediaone.net.