How do I move mail from an old server to a new server?

I am rebuilding my server. The new server runs on OS X 10.9.4 with Server 3.1.2. The old server ran OS X 10.9.x and Server 3.x (the exact versions are not known).
Within the folder /Library/Server/Mail, I found the email stores for both systems.  I have gone through each folder and identified the 36 character string that serves to identify the user's mailbox and paired each one to a user id on both systems.  On the old system, there are multiple mailboxes for some users, and I think it is a result of the users being deleted and recreated: perhaps the system identified the identical name and assumed that the user might be different and therefore created a unique 36 character id for the mail system.
The trick is, I am trying to recover the mail from the old server.
I have attempted to copy the files which are human readable and formatted for SMTP transmission to the new server under the correct mailbox corresponding to the owning user (see screen shots below). The simple act of copying the files has not made these files visible via the IMAP protocol. I have tried restarting the mail service hoping that the Server app would rebuild whatever indexes need to be built so that the mail can be served via IMAP, and that has not worked either.
The question is, how do I get the mail from the old server mail boxes into the new server mailboxes?
This screen shot shows the location of one mail collection at /Library/Server/Mail/Data/mail/[userid].  Mail sits in the "new" folder only for a moment before being processed and put into the "cur" folder.  Copying mail from the old server into the "new" folder produces an empty "new" folder, but one can see the files populate briefly before they are moved into the "cur" folder.
The next screen shot shows one email opened in TextEdit.  The format should look very familiar.  This is the same format that one would use to send SMTP requests to an SMTP server.  This particular example happens to be an email from a Gmail account to the PediatricHeartCenter.org domain to test the mail system when the old server was set up.  It was sent on 24 Jan 2014 and had text reading "Intended for Mavericks1. -Jared".

On further research, I have learned that OS X Server sets Dovecot to use the MailDir format.  The email messages can be removed from the folders and put back, and as long as they were present in the folder to begin with (received by Dovecot originally), they reflect in the Mail.app on client computers.  Deleting a file in the "cur" folder causes the file to disappear in Mail.app. Copying the file back into the "cur" folder will cause the file to reappear without any modification of an index file or any other system component, as long as the file was properly formatted by Dovecot to be identifiable to that folder.
According to Dovecot.org's review of MailDir found here (http://wiki2.dovecot.org/Ma,ilboxFormat/Maildir), the file name can be broken into simple pieces: " [unixtimestamp].[process id].[hostName],S=<message size>,W=<virtual message size>/2,[status tags]".  The original MailDir++ specification requires the string ":2," to appear after the virtual size, but this file naming format is not legal in Mac OS X, so Dovecot is modified by Apple to use "/2," instead.
The Dovecot's wiki describes inserting new messages as follows:
Mail delivery
Qmail's how a message is delivered page suggests to deliver the mail like this:
Create a unique filename (only "time.pid.host" here, later Maildir spec has been updated to allow more uniqueness identifiers)
Do stat(tmp/<filename>). If the stat() found a file, wait 2 seconds and go back to step 1.
Create and write the message to the tmp/<filename>.
link() it into new/ directory. Although not mentioned here, the link() could again fail if the mail existed in new/ dir. In that case you should probably go back to step 1.
All this trouble is rather pointless. Only the first step is what really guarantees that the mails won't get overwritten, the rest just sounds nice. Even though they might catch a problem once in a while, they give no guaranteed protection and will just as easily pass duplicate filenames through and overwrite existing mails.
Step 2 is pointless because there's a race condition between steps 2 and 3. PID/host combination by itself should already guarantee that it never finds such a file. If it does, something's broken and the stat() check won't help since another process might be doing the same thing at the same time, and you end up writing to the same file in tmp/, causing the mail to get corrupted.
In step 4 the link() would fail if an identical file already existed in the maildir, right? Wrong. The file may already have been moved to cur/ directory, and since it may contain any number of flags by then you can't check with a simple stat() anymore if it exists or not.
Step 2 was pointed out to be useful if clock had moved backwards. However again this doesn't give any actual safety guarantees, because an identical base filename could already exist in cur/. Besides if the system was just rebooted, the file in tmp/ could probably be even overwritten safely (assuming it wasn't already link()ed to new/).
So really, all that's important in not getting mails overwritten in your maildir is the step 1: Always create filenames that are guaranteed to be unique. Forget about the 2 second waits and such that the Qmail's man page talks about.
The process described by the QMail man page referenced above suggests that as long as a file is placed in the "new" folder, that a mail reader can access it.  The mail reader then moves the file to the "cur" folder and "cleans up" the "new" folder.  This is clearly happening in OS X, because the messages are moving from "new" to "cur", but IMAP is still not serving these foreign messages to the remote readers.
The thought crossed my mind that perhaps it is the fact that the host name does not match, which would cause the failure, however changing the "host" portion of the name from the old-server to the new-server did not fix the issue.  Even with the new server name in the file name, the inserted message fails to appear in client Mail applications.
Within the file their is header information that still references the old machine. I'd like to not have to change the email files, because this will violate the integrity of the message. Also, this might take a lot of time or incur risks associated with poor automated processing. The header information should not be referenced by Dovecot, because the wiki page describing MailDir notes that neither Dovecot nor Dovecot's implementation of IMAP refers to the messages header information when moving and serving these mail files.
Unlike when using mbox as mailbox format, where mail headers (for example Status, X-UID, etc.) are used to determine and store meta-data, the mail headers within maildir files are (usually) notused for this purpose by dovecot; neither when mails are created/moved/etc. via IMAP nor when maildirs are placed (e.g. copied or moved in the filesystem) in a mail location (and then "imported" by dovecot). Therefore, it is (usually) not necessary, to strip any such mail headers at the MTA, MDA or LDA (as it is recommended with mbox).
This paragraph leads me to believe that after the mail box is identified that the content of the file becomes irrelevant to the system which manages. This suggests that we should be able to inject messages into a mailbox and have the system serve them as though they had belonged in that mailbox all along. Yet I have not found a way to do this.

Similar Messages

  • How do I move apps from an old mac to a new one

    I am purchasing a new Macbook Pro after having my old one for six years. I have numerous apps that I have purchased and downloaded over the years. I don't want to loose them and really don't want to have to purchase them again. Can I and how can I move apps from my old Mac to my new one?

    Be sure you back your current system up BEFORE you do anything. If you use Time Machine, migration assistant works well.
    Barry

  • How do I move pse9 from my old laptop to a new one?

        How do I move pse9 from my old laptop to a new one?

    I have my original disk, but I believe I need to de-ctivate the existing copy before installing on the new computer.

  • How do I move bookmarks from an old profile to a new profile?

    I have created a new profile for Firefox and have a huge amount of bookmarks in my old profile. How can I move the bookmarks from my old profile to the new one? I have tried backing up my old bookmarks and then restoring them on the new profile's bookmark library, but this didn't work (the file wouldn't show up and when I put it in a folder to force it to show up it wouldn't do anything). So how can I do this?

    http://support.mozilla.com/en-US/kb/Recovering+important+data+from+an+old+profile

  • How do i move Itunes from my old computer to my new one?

    Trying to move Itunes account from old computer to new one.  Am not sure if I install Itunes on new computer will it then allow me to log in and obtain my already purchased games/music or will i lose from old to new computer?

    These are two possible approaches that will normally work to move an existing library to a new computer.
    Method 1
    Backup the library with this User Tip.
    Deauthorize the old computer if you no longer want to access protected content on it.
    Restore the backup to your new computer using the same tool used to back it up.
    Keep your backup up-to-date in future.
    Method 2
    Connect the two computers to the same network. Share your <User's Music> folder from the old computer and copy the entire iTunes library folder into the <User's Music> folder on the new one. Again, deauthorize the old computer if no longer required.
    Both methods should give the new computer a working clone of the library that was on the old one. As far as iTunes is concerned this is still the "home" library for your devices so you shouldn't have any issues with iTunes wanting to erase and reload.
    I'd recommend method 1 since it establishes an ongoing backup for your library.
    If you have an iOS device that syncs with contact & calendar data on your computer you should migrate this information too. If that isn't possible create a dummy entry of each type in your new profile and iTunes should offer to merge the existing data from the device into the computer, otherwise the danger is that it will wipe the information from the device.
    If your media folder has been split out from the main iTunes folder you may need to do some preparatory work to make it easier to move. See make a split library portable.
    Should you be in the unfortunate position where you are no longer able to access your original library, or a backup of it, then see Recover your iTunes library from your iPod or iOS device for advice on how to set up your devices with a new library with the maximum preservation of data.
    tt2

  • How do i move itunes from an old computer to a new computer?

    I just purchased a new laptop and am trying to put itunes on it.  I have an iphone 3gs.  I authorized the computer and synced but it will not transfer my music.  Help...what am i doing wrong?
    Thanks

    These are two possible approaches that should work to move an existing library to a new computer.
    Method 1
    Backup the library with this User Tip.
    Restore the backup to your new computer using the same tool used to back it up.
    Deauthorize the old computer if you no longer want to access protected content on it.
    Keep your backup up-to-date in future.
    Method 2
    Connect the two computers to the same network. Share your <User's Music> folder from the old computer and copy the entire iTunes library folder into the <User's Music> folder on the new one. Again, deauthorize the old computer if no longer required.
    Both methods should give the new computer a working clone of the library that was on the old one. As far as iTunes is concerned this is still the "home" library for your devices so you shouldn't have any issues with iTunes wanting to erase are reload.
    I'd recommend method 1 since it establishes an ongoing backup for your library.
    Should you be in the unfortunate position where your computer has died with no backup then see Recover your iTunes library from your iPod or iOS device.
    tt2

  • How do I move music from my old IPhone to a new one?

    My old music is from CD's that I own.  I put them on my phone a couple years ago thru Itunes with no problem.  Now it seems that Itunes will only let me add music to my phone if I buy it from them. 

    I'm using a PC, not a Mac.  My system is using Wi-Fi.  And like I say, using ITunes there is no way to upload my music to my IPhone.  Clicking on devices only gives me the option to Sync, and restore.  I've even tried backing up the old phone, which has the same name as the new one, and then restoring it to the new phone but it won't move the music to the new phone.  I checked out the ITunes Match.  Now I'm not a real bright guy but it looks like Apple wants me to pay them $25 a year to listen to my own music on my own phone.  I mean, it's not like I'm stealing anything.  I paid for the phone and I paid for the music.  Why should I have to pay them to sisten to it? 

  • How do I move contacts from my old candybar Nokia to my iPhone?

    How do I move contacts from my old candybar Nokia to my iPhone? - now that I can't import using the old SIM card.

    Perhaps the fastest and simplest way would be to just take both devices to the nearest AT&T corp. store and get them to do it.  Then you can sync the iPhone with Contacts on your Mac (or outlook on your PC) or with iCloud to back them up for safekeeping.

  • I use migrate assistant to move files from my old pc to the new Mac , but it creates the user account. How can i delete the unwanted user account.

    i use migrate assistant to move files from my old pc to the new Mac , but it creates the user account. How can i delete the unwanted user account.

    Welcome to Apple Support Communities
    That's the classic behaviour after using Migration Assistant and that's normal.
    To transfer the data from the new user account to your old user account, you can follow some steps. Here is all the information you need to do this > https://discussions.apple.com/docs/DOC-5472

  • How do i move itunes from my old desktop to new windows 7 laptop

    How do I move Itunes from my old desktop computer which runs Windows XP to my HP Laptop that runs Windows 7.

    1. On the old computer, connect an USB drive, go to the Music folder and copy iTunes folder to the USB drive.
    2. Connect your USB drive to the new computer and copy iTunes folder to the Music folder.
    3. Open iTunes and your library will show on your PC

  • Just bought a new macbook w/ mtn lion. transferred data from my old macbook over n it created another user name. that's actually good--xcept for music, which i want on my new acct. How do i move files from my "old comp" acct to my new one?

    i just bought a new macbook w/ mtn lion. when i transferred data from my old macbook over, it created another user name (i called it "old computer"). That's actually good--I'm not going to be accessing old files frequently--except for music, which i want on my new user name. How do i move files from my "old comp" account to my new one? Is there a way to easily move large #'s of files, or just one by one? I've googled extensively but can only find instructions for OSX 10.6 and previous, which talks about the "Shared folder," which I can't seem to find.      

    jesster03 wrote:
    i just bought a new macbook w/ mtn lion. when i transferred data from my old macbook over, it created another user name (i called it "old computer"). That's actually good
    That's actually bad. Peruse Pondini's Setup New Mac guide and seriously consider starting over.

  • I have acrobat professional and photoshop elements. New Mac arrives next week how do I move these from the old machine  as I cannot find the product codes

    I have acrobat professional and photoshop elements. New Mac arrives next week how do I move these from the old machine  as I cannot find the product codes

    You cannot move or copy software between computers. You must reinstall. You will need the serial number. Check your account details on Adobe's site if you registered.

  • I have bought a new Mac Book Pro, and I need to know how I can move Aperture from my old Mac Book to the new one..

    I have bought a new Mac Book Pro, and I need to know how I can move Aperture from my old Mac Book to the new one..

    It begins with: F-285-NER-151-QBQ-and continues with 5 more 3 or 4 letters/numbers..
    Yes, that is the number. And what version of Aperture have you installed? The same version as on your old Mac?
    But it don´t work on my new Mac...
    In what way does it not work? Does it require you to enter a licence number for Aperture 2 as well? That will be necessary, if your serial number is an upgrade serial number. Then you will have to enter all previous numbers as well.
    Or does Aperture not accept the number as correct? Then check the spelling; some letters are easily confused like "I" and "1" and "O" and "0". Do not use the number pad to enter the numbers.
    See: Troubleshooting Professional Application Serial Numbers
    Regards
    Léonie

  • How do I stop mail from loading old mail?

    how do I stop MAIL from loading old messages

    What type of email account are you using, POP, IMAP if you are using an IMAP account then you would need to go into your mail settings and change the delete mail after a day, week, month, never. 

  • How do I copy everything from my old Iphone to my new one?

    How do I copy everything from my old iphone to my new one?

    Refer to these articles:
    iTunes: How to move your music to a new computer
    http://support.apple.com/kb/HT4527
    iTunes: Back up your iTunes library by copying to an external hard drive
    http://support.apple.com/kb/HT1751

Maybe you are looking for

  • Hi I have problem with desktop assign

    When I try to assign Calendar to desktop 4 everythink looklike ok but when I open app, OS changed assign. Now it's opened in desktop 2 and now this app is assigned to desktop 2. Please help.

  • WAKE ME UP!

    I recently purchased both a *Magic Mouse* and an *Apple Wireless Keyboard*; and since my Mac didn't already have an internal BT adapter I picked up an IOGEAR Bluetooth (http://www.iogear.com/product/GBU421/) but later realized that the +Allow Bluetoo

  • Oracle 10gR2 (10.1.2.0.0)

    is there any way to install 10gR2 (10.1.2.0.0) on unbreakable Linux ? i had install 10.1.2.0.2 on unbreakable but it's not possible installation 10.1.2.0.0 ! ! !

  • Using a 2-D array Single Process Shared Variable w/ RT FIFO for comm between a Deterministic and non-deterministic loop on an RT Target

    Our problem is that we currently use a 2D array to store CAN data on a Real-time Target. The array is 20 elements of 3 byte elements as so:                 0              1              2 0              [byte]   [byte]   [byte] 19           [byte]  

  • Theme Editor and pageToolBar

    Hello, Can we change the look and feel of the Page Tiltle Bar (com.sap.portal.pageToolbar) with the Theme Editor ? Thanks, Fabien