[Evolution] Pegasus Mail Conversion Mini HOWTO



Hi,

first, hats off to Ximian for a great product. The automatic fulltext
indexing of mail (and resulting vfolder functionality) is something that
I'm missing from every other client, and it will greatly increase my
productivity.

I previously used Pegasus Mail for Windows, and what follows is a quick
HOWTO to convert PM folders to Evolution. It's not very well-researched,
so there may well be errors, but the procedure should work. It's
non-obvious though. The following is public domain, of course.

Pegasus Mail -> Evolution Conversion Mini HOWTO
-----------------------------------------------

Pegasus Mail supports two formats for message storage: A proprietary
format and the UNIX mbox format which is also used by Evolution. Like
Evolution, Pegasus stores its metadata/indices in separate files.

I have not bothered trying to rescue metadata like Read/Unread
information, priorities, annotation etc. -- this would be difficult as
equivalents do not always exist. So this procedure only describes
converting the actual mail data, not the metadata.

First, you need to make sure that your Pegasus mail data is in the UNIX
mbox format. To do so, check the folder properties in the "Folders"
dialog in Pegasus. If it is not, create a new folder with the UNIX mail
format, and copy all the messages in the folder to the new one. This
will take a while for large folders. It should be a fairly safe
procedure, but in any case, you may want to backup first.

In your Pegasus mail directory, you should now have a file of the name
format

        UNX?????.MBX

Where ? are numbers from 0-9. This is the actual message box. The file
with the same name and the extension PMG is the index.

Copy the MBX file to your Un*x partition. 

It should be trivial to use this file with Evolution, but it isn't.
Unfortunately, Pegasus uses a format that slightly deviates from the
standard. Namely, lines beginning with the word "From " are not escaped
(they should read ">From " or begin with a MIME code). This means they
are recognized as actual "From " message headers by Evolution (mutt
reads the file without problems, so this may change in a later version
of Evolution). As a result, you will get split messages like this:

The message subject                     Feb 14
___________empty subject________        ?

where the second message contains the part after the "From" and the
first message contains the part until the "From". The paragraph
containing the "From" itself remains hidden.

Fortunately, this is not a big issue, since Pegasus also formats actual
"From " lines in a unique manner, namely: "From ??? ???" (yes, these are
questionmarks -- the real email address is contained in the From:
header). This allows us to securely recognize only the "From " lines we
are looking for and replace them with the proper, escaped syntax 
(">From ").

To do this, we use sed, the "stream editor". Sed takes an input file,
manipulates it in a programmable way and generates an output stream,
which we can redirect into a file. sed is the perfect tool for the job
at hand, and is probably installed on your system, unless you use a
Linux distribution which treats its users like children. We use the
following command:

user system$ sed -e '/??? ???/!s/^From />From /' mboxname > resultname

In plain English, this means: Replace all occurences of "From " (note
the blank) at the beginning of a line with ">From ", unless they contain
the string ??? ???  Consult the sed manpage and FAQ, as well as the
countless tutorials on the web, for more information on how to do even
niftier things with sed.

That's it! Now we can safely use the mailbox with Evolution. Use the
import druid (autodetection or mbox format), pick the file and choose a
destination folder, and you're ready to search and filter your old mail
in unprecedented lightning-speed.

Problems? Suggestions? -> moeller scireview de




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]