Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Import mailboxes from Thunderbird into Mail.app' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Import mailboxes from Thunderbird into Mail.app
Authored by: PeaceFreak on Jun 18, '05 05:25:50PM

This might be of relevance to Thunderbird: I copied it from a thread in the Apple Users Forums:

Hi all,

With the help of somebody having these problems (since I have not used Mozilla, I didn't have a testbed myself), I took a look at the problem and came up with a solution.

1. The problem:
Mozilla does not seem to use mbox files according to the relevant RFCs - some older versions of Mozilla seemed to have used Mac end-of-line (EOL) characters instead of the *nix ones (i.e., char(13) instead of char(10)) - some mailbox files might even have a mixture of the two
Mozilla stores the message status flags as well as the information whether a message has been deleted in two additional headers (X-Mozilla-Status and X-Mozilla-Status2) - Mail's import ignores those headers and all messages therefore import as unread. Additionally, Mail might also import messages which had been deleted in Mozilla before

2. The solution:
First, you will have to change all EOLs in all mailboxes to *nix style - I created an AppleScript which takes care of that (in order not to hit the maximum post length here, I will post the script in a separate message).
Second, you use Apple's import function to import the mailboxes (you can use "Other" or "Mozilla" for the import)
Third, you run another AppleScript (an improved version of the one I posted above) which adjusts all the message flags and deletes messages in Mail which should not have been imported
Fourth, you let Apple know that they should fix this problem (and, by linking here, tell them how to fix it) :-) http://www.apple.com/macosx/feedback/

Andreas

Here is the script to change all EOL characters to *nix style.

NOTE: the script changes the files you drop onto it - if you plan on using the mailboxes in Mozilla again, you might want to work on a copy of the files instead of the originals.

Select all the text inside the gray box and create a new AppleScript from it (use the "Services ? Apple Script ? Make New AppleScript" menu entry in the application menu (which currently most probably says "Safari"):

on run
set theFolder to choose folder with prompt "Please choose the folder containing your mailbox files"
processObject(theFolder)
display dialog "Conversion finished" buttons {"OK"} default button 1
end run

on open theObjects
repeat with theObject in theObjects
processObject(theObject)
end repeat
display dialog "Conversion finished" buttons {"OK"} default button 1
end open

on processObject(theObject)
set theInfo to info for theObject
if theInfo is folder then
set theContents to list folder theObject
repeat with theItem in theContents
set thePath to ((theObject as string) & theItem)
processObject(thePath as alias)
end repeat
else
set thePath to POSIX path of theObject
do shell script "perl -pi -e 's/\\r\\n/\\n/g' " & quoted form of thePath
do shell script "perl -pi -e 's/\\r/\\n/g' " & quoted form of thePath
end if
end processObject


Save the script as an application (using the drop-down item in the save dialog)

You can now drop files and/or folders onto the scripts icon (or run the script by double-clicking and select a folder to convert all files therein) - the script will change the EOL character for all files inside this folder (recursively).

Here is the script which adjust all message status flags and deletes messages in Mail which had been deleted in Mozilla.

Select all the text inside the gray box and create a new AppleScript from it (use the "Services ? Apple Script ? Make New AppleScript" menu entry in the application menu (which currently most probably says "Safari"):

tell application "Mail"
set theMsgs to (get selection)
repeat with eachMsg in theMsgs
try
set MozHeader to content of header "X-Mozilla-Status" of eachMsg
if (character 4 of MozHeader) is in {"8", "9", "A", "B", "C", "D", "E", "F"} then
set deleted status of eachMsg to true -- 0x0008
else
if (character 4 of MozHeader) is in {"1", "3", "5", "7"} then
set read status of eachMsg to true -- 0x0001
else
set read status of eachMsg to false
end if
if (character 4 of MozHeader) is in {"2", "3", "6", "7"} then
set was replied to of eachMsg to true -- 0x0002
else
set was replied to of eachMsg to false
end if
if (character 1 of MozHeader) is in {"1", "3", "5", "7", "9", "B", "D", "F"} then set was forwarded of eachMsg to true -- 0x1000
end if
end try
end repeat
end tell



You can run this script either directly from the Script Editor (make sure not to show the "Event Log" in the bottom pane since this will significantly slow down its operation) or save it as an application and run it by double-clicking.

Select all the messages in your imported mailboxes (you can select multiple mailboxes in the mailbox list and all messages from all those mailboxes will be shown in the message list - click into the message list and chose "Select All") and run the script - when it is finished, all your messages should have the proper message status and you shouldn't see any messages you deleted in Mozilla.

Andreas
A possilbe future version of my freeware Eudora Mailbox Cleaner should be able to handle this importing problem. Check it out... <http://homepage.mac.com/aamann/Eudora_Mailbox_Cleaner.html>



[ Reply to This | # ]
Import mailboxes from Thunderbird into Mail.app
Authored by: duhamel on Sep 07, '05 10:34:17PM

Andreas,

This worked GREAT!!

Here's what I had to do.

I HAD Outlook Express on winxp (It is not being used much anymore).

1. I downloaded Thunderbird for windows and installed it. Thunderbird automatically imported my OE e-mail over.

2. I downloaded Thunderbird for Mac and installed it. Then, I copied my "profile" folder over to my Mac. Thunderbird then opened with all my mail.

3. I ran the script to change all EOL characters to *nix style (Thanks to Andreas!) against my Thunderbird mail folder.

4. I opened the Mail.app and imported all my e-mail - it worked GREAT!


Address Book:

1. Open Thunderbird and export your address book to "Ldif" format
2. Open the "Address Book" app and import. Address Book will ask what format you want to import from. Choose "Ldif" and tell it where your file is that was created in step #1.

3. Sit back, have a drink and be happy you're off of outlook express... a.k.a. "outbreak".

Cheers.



[ Reply to This | # ]