Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Evolution to Thunderbird Mail Conversion Process
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
gnac
Guru
Guru


Joined: 30 Jun 2003
Posts: 302
Location: Columbia River Gorge

PostPosted: Wed Dec 01, 2004 7:50 pm    Post subject: Evolution to Thunderbird Mail Conversion Process Reply with quote

I've come up with a process to "import" mail from evolution to thunderbird. I've seen scripts that attempt to do this, but they never worked right. I followed this process using a text editor and a bash shell, but I'm sure someone could right a script to do this automajically. I could do it in Java or C, but I think it would get more use as a script (bash, perl, python...) You can always use bash and a text editor if you can't wait for someone to script this.

In a nutshell heres what has to happen:

Evolution stores its mail in "mbox" files in "subfolder" directories.
Code:
/home/USERNAME/evolution/local/Inbox/mbox
/home/USERNAME/evolution/local/Inbox/subfolders/Work/mbox
/home/USERNAME/evolution/local/Inbox/subfolders/Work/subfolders/Project1/mbox

Thunderbird stores its mail in user named file in a folder based on the parent mail box with an ".sbd" extension. So the Evolution Mailboxes above will become:
Code:
/home/USERNAME/.thunderbird/default.i9c/Mail/Local\ Folders/Imports.sbd/Inbox
/home/USERNAME/.thunderbird/default.i9c/Mail/Local\ Folders/Imports.sbd/Inbox.sbd/Work
/home/USERNAME/.thunderbird/default.i9c/Mail/Local\ Folders/Imports.sbd/Inbox.sbd/Work.sbd/Project1


Heres the total steps involved followed by the details for each step. I'm using a bastardized version of psuedocode here, so don't expect the commands to work as written.


Steps:

1 Create a list of all the mbox's in use by evolution.
2 Create a place in the Thunderbird file structure to store the imported mailboxes.
3 Use the mbox list to determine required directory structure in the Thunderbird repository
3a Make the required directory structure in Thunderbird
4 Use mbox list to determine required mbox names Thunderbird
4a Copy mbox's into Thunderbird structure with new names


Details:
1 Find all mbox's in use by evolution, and store them in a list (evoMboxList).

Code:
find /home/USERNAME/evolution/ -iname mbox > evoMboxList


This will return a list similar to this:

Code:
   /home/USERNAME/evolution/local/Sent/mbox
   /home/USERNAME/evolution/local/Drafts/mbox
   /home/USERNAME/evolution/local/Inbox/mbox
   /home/USERNAME/evolution/local/Inbox/subfolders/Personal/mbox
   /home/USERNAME/evolution/local/Inbox/subfolders/Work/mbox
   /home/USERNAME/evolution/local/Inbox/subfolders/Work/subfolders/Project1/mbox
   /home/USERNAME/evolution/local/Inbox/subfolders/Work/subfolders/Project1/subfolders/Issues/mbox
   /home/USERNAME/evolution/local/Inbox/subfolders/Work/subfolders/Project2/mbox   


If we strip the Evolution specific part of the path, it will make for easier reading, but we will need the full path for later on.

Code:
replace "/home/USERNAME/evolution/local/" with "" > evoMboxStippedList


Code:
   Sent/mbox
   Drafts/mbox
   Inbox/mbox
   Inbox/subfolders/Personal/mbox
   Inbox/subfolders/Work/mbox
   Inbox/subfolders/Work/subfolders/Project1/mbox
   Inbox/subfolders/Work/subfolders/Project1/subfolders/Issues/mbox
   Inbox/subfolders/Work/subfolders/Project2/mbox


2 Create a place in the Thunderbird file structure to store the imported mailboxes.

We do not want to mangle any existing folders in Thunderbird so we will have to create a unique folder to import everthing into.
The default location in thunderbird is something like this:

Code:
.thunderbird/default.i9c/Mail/Local\ Folders/


I believe the "i9c" part of "default.i9c" is profile specific, so this might need to be a user supplied location (i.e. where to create the imported folders). Regardless, we will create a Thunderbird mailbox and subfolder for imports.

Code:
   // find a unique name
   if ".thunderbird/default.i9c/Mail/Local\ Folders/Imports" does not exist
   {
      // create the file
      touch .thunderbird/default.i9c/Mail/Local\ Folders/Imports
      // create the subdirectory
      mkdir touch .thunderbird/default.i9c/Mail/Local\ Folders/Imports.sbd
   }
   else
   {
      // try again with a different name;
   }


3 Use the list of mbox's to create the required directory structure in Thunderbird

Thunderbird uses a regular name for its email files instead of mbox (eg inbox vs inbox/mbox) along with a subdirectory based on that name (eg inbox.sbd) to store its subfolders as opposed to the "subfolders" directories used by Evolutions. So, using the evoMboxStrippedList we want to create a new list, sbdBoxList, by replacing "/subfolders/" with ".sbd/".

Code:
replace "/subfolders/" with ".sbd/" > sbdBoxList


Code:
   Sent/mbox
   Drafts/mbox
   Inbox/mbox
   Inbox.sbd/Personal/mbox
   Inbox.sbd/Work/mbox
   Inbox.sbd/Work.sbd/Project1/mbox
   Inbox.sbd/Work.sbd/Project1.sbd/Issues/mbox


We need to keep a copy of this list around for later so next, create another list, sbdDirList, by replacing every instance of "/mbox" with ".sbd". This is a little overkill, as this implies that every mbox has subfolders which it does not. Maybe we could instead find the last instance of .sbd on each line and strip the rest, but then this can give us redundant entries, so I'll leave it up to you.

either replace "/mbox" with ".sbd" > sbdDirList giving

Code:
   Sent.sbd   // not needed
   Drafts.sbd   // not needed
   Inbox.sbd
   Inbox.sbd/Personal.sbd
   Inbox.sbd/Work.sbd
   Inbox.sbd/Work.sbd/Project1.sbd
   Inbox.sbd/Work.sbd/Project1.sbd/Issues.sbd    // not needed


or, if a line contains ".sbd" stripping from the last .sbd in the line to the end > sbdDirList gives

Code:
   Inbox.sbd   
   Inbox.sbd   // redundant
   Inbox.sbd/Work.sbd
   Inbox.sbd/Work.sbd/Project1.sbd


Finally, use this list to create a directory structure in the appropriate place in the thunderbird repository.

Code:
   cd ~/.thunderbird/default.i9c/Mail/Local\ Folders/Imports.sbd

   // create each directory, i.e.
   //    ~/.thunderbird/default.i9c/Mail/Local\ Folders/Imports.sbd/Sent.sbd
   //   ~/.thunderbird/default.i9c/Mail/Local\ Folders/Imports.sbd/Drafts.sbd
   //   ~/.thunderbird/default.i9c/Mail/Local\ Folders/Imports.sbd/Inbox.sbd
   //   ~/.thunderbird/default.i9c/Mail/Local\ Folders/Imports.sbd/Inbox.sbd/Personal.sbd
   //   ~/.thunderbird/default.i9c/Mail/Local\ Folders/Imports.sbd/Inbox.sbd/Work.sbd
   //   ~/.thunderbird/default.i9c/Mail/Local\ Folders/Imports.sbd/Inbox.sbd/Work.sbd/Project1.sbd
   //   ...
   for (each $1 in sbdDirList)
    {
       mkdir -p $1       
    }


4 Copy the evolution mbox's into their new location.

first, create a list of the mbox names as used in Thunderbird. This is easy. remove every instance of "/mbox" from sbdBoxList

using
Code:
sbdBoxList:
   Sent/mbox
   Drafts/mbox
   Inbox/mbox
   Inbox.sbd/Personal/mbox
   Inbox.sbd/Work/mbox
   Inbox.sbd/Work.sbd/Project1/mbox
   Inbox.sbd/Work.sbd/Project1.sbd/Issues/mbox


Code:
replace "/mbox" with "" > sbdNamedList

becomes
Code:
   Sent
   Drafts
   Inbox
   Inbox.sbd/Personal
   Inbox.sbd/Work
   Inbox.sbd/Work.sbd/Project1
   Inbox.sbd/Work.sbd/Project1.sbd/Issues


Now copy each mbox from the evoMboxList to file name given by sbdNamedList. I'm going to do each line manually hear to be explicit. Make sure to either be in the correct place in the thunderbird repository path, or use the full path below.

Code:
   cp ~/evolution/local/Sent/mbox    Sent
   cp ~/evolution/local/Drafts/mbox    Drafts
   cp ~/evolution/local/Inbox/mbox    Inbox
   cp ~/evolution/local/Inbox/subfolders/Personal/mbox    Inbox.sbd/Personal
   cp ~/evolution/local/Inbox/subfolders/Work/mbox    Inbox.sbd/Work
   cp ~/evolution/local/Inbox/subfolders/Work/subfolders/Project1/mbox    Inbox.sbd/Work.sbd/Project1
   cp ~/evolution/local/Inbox/subfolders/Work/subfolders/Project1/subfolders/Issues/mbox    Inbox.sbd/Work.sbd/Project1.sbd/Issues


Now you have a directory structure under the "Local Folders" directory of your thunderbird repository consisting of the renamed mboxes from Evolution and any necessary subdirectories. I suggest trying it out with a single mbox and perhaps a subfolder before going into any major batch testing.

Good Luck and let me know if you have any questions about the process or other issues.
_________________
"I thought she'd steal my heart, instead she stole my kidney,
and now its for sale, on the black market in Sydney" - Better Abraham
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum