Koozali.org: home of the SME Server

Contribs.org Forums => General Discussion => Topic started by: Derek on April 23, 2007, 05:38:44 AM

Title: Recover Email from SME 6 for use on SME 7
Post by: Derek on April 23, 2007, 05:38:44 AM
I had an SME 6 server who's hard drive started to fail so i put in a new drive with SME 7 and got it up and running.
Problem is I have emails sitting on my Ver. 6 hard drive that i need to get back to my new install.

I was able to access the old drive via USB on my XP machine and save my maildir, but I am looking for help to get this information showing on my new install so i can access it via Outlook.

FYI, i was getting my mail via IMAP previously if that matters.

thanks
Derek
Title: Recover Email from SME 6 for use on SME 7
Post by: william_syd on April 23, 2007, 02:10:35 PM
Do a search and hunt around. I'm almost 100% sure your question has been answered before.

The key thing is mail folders in 6 are seperated by a ; and in 7 it's a .
And permissions have to be set correctly.

There was even a script to do the copying for you.
Title: Recover Email from SME 6 for use on SME 7
Post by: william_syd on April 23, 2007, 02:39:12 PM
Try this...

http://forums.contribs.org/index.php?topic=34549.0
Title: Recover Email from SME 6 for use on SME 7
Post by: Derek on April 24, 2007, 12:36:26 AM
William

Key info for 6 to 7 mail transfer.

is this the one you want me to follow?

I think i followed it right but i got a bash error cur not found
I dont know what this means in linux world.

I also saw the script part but i dont konw how to execute a script
I have put a copy of my old emails in an ibay on my server to copy over but
the commands as i mention dont seem to be working

thanks again
Derek
Title: Recover Email from SME 6 for use on SME 7
Post by: william_syd on April 24, 2007, 10:42:13 AM
Make a new user eg derick2

Copy your mail to the primary ibay under files. Something like..
/home/e-smith/files/ibays/Primary/files/users/derick2/Maildir

Log into the console as root.

Get the script..
Code: [Select]
wget http://mirror.contribs.org/smeserver/contribs/wscott/Forum_Scripts/copymail

Change permissions..
Code: [Select]
chmod 744 copymail

Run the script
Code: [Select]
./copymail

When it asks for a username, enter derick2

When all done, fire up thunderbird. Create an account for your current username and also derick2 under the same profile.

Now just drag and drop email from one to the other.
Title: Recover Email from SME 6 for use on SME 7
Post by: Derek on April 24, 2007, 02:22:44 PM
cool, going to try that, just one question. I use Outlook 2003 should it work fine for that too?
Title: Recover Email from SME 6 for use on SME 7
Post by: bpivk on April 24, 2007, 02:31:03 PM
Yes. It will work with any mail client.
Title: Recover Email from SME 6 for use on SME 7
Post by: Derek on April 24, 2007, 03:06:14 PM
This is what i got for a reply.
the username really is Derek2 but i thought i would try it both ways as it didnt seem to work.
any thoughts?


[root@dataserver ~]# ./copymail
Enter User Name:
Derek2
ls: ;*: No such file or directory
chown: `Derek2:Derek2': invalid user
[root@dataserver ~]# ./copymail
Enter User Name:
derek2
./copymail: line 18: cd: /home/e-smith/files/ibays/Primary/files/users/derek2/Maildir: No such file or directory
ls: ;*: No such file or directory
chown: `derek2:derek2': invalid user
[root@dataserver ~]#
Title: Recover Email from SME 6 for use on SME 7
Post by: bpivk on April 24, 2007, 03:25:48 PM
Quote
Copy your mail to the primary ibay under files. Something like..
/home/e-smith/files/ibays/Primary/files/users/derick2/Maildir

Did you do this step?
Title: Recover Email from SME 6 for use on SME 7
Post by: Derek on April 24, 2007, 09:49:10 PM
/home/e-smith/files/ibays/Primary/files/users/derek2/Maildir
that is where i copied the files to. Within that folder i have INBOX, INBOX Derek etc etc etc for each folder i had my mail sorted in.

Now the script you gave me i installed in the root dir
could that be the problem that when i run copymail from the root it doesnt see the folder?

Tell me your thoughts :)

Thanks
Title: Recover Email from SME 6 for use on SME 7
Post by: william_syd on April 26, 2007, 09:11:35 AM
Do you see this sort of folder structure ?

Quote
/home/e-smith/files/ibays/Primary/files/users/ventrilo/Maildir/;Kept Mail;Adobe
Title: Recover Email from SME 6 for use on SME 7
Post by: Derek on April 26, 2007, 02:29:32 PM
if i look at the old drive through linux viewer in WinXP
the dir looks like this
Linux native Volume 2\home\e-smith\files\users\sales\Maildir\;INBOX;Derek

if i look at in via SSH using MC i see this
/home/e-smith/files/ibays/Primary/files/users/sales/Maildir/_INBOX_Derek

when i copied the files off the old drive through XP it appears it changed the structure?

Derek
Title: Recover Email from SME 6 for use on SME 7
Post by: bpivk on April 26, 2007, 02:46:00 PM
Code: [Select]
# Script to copy mail files from SME 6 to SME 7

# Get username from console
echo "Enter User Name:"
read uname

# Location Variables:
# --Set the source to the users directory of your SME 6 data
#
# --The destination is already set to the SME 7 default
# --you may change it if you would like to move to different directory
#
# Source and destination directories must be in the form username/Maildir/
sourceloc=/home/e-smith/files/ibays/Primary/files/users
destloc=/home/e-smith/files/users

cd $sourceloc/$uname/Maildir
ls -d1 '_'* | (
while read DIR
do
        newpath=$(echo $DIR | awk '{gsub(/_/,"."); print $0}')
        mv "$sourceloc/$uname/Maildir/$DIR" "$destloc/$uname/Maildir/$newpath"
done
)

chown -R $uname:$uname $destloc/$uname

# All is done, your folders are copied


Would this modified script do?  I have changed ; to _ as it seems that xp really did change the folder structure.
Title: Recover Email from SME 6 for use on SME 7
Post by: william_syd on April 26, 2007, 03:59:27 PM
How many mailboxes are we talking about here ?

Could you just connect to SME with WinSCP (use SCP protocol) and rename the folders and change the ownership of them ?

Yes, the modified script will probably do it.
Title: Recover Email from SME 6 for use on SME 7
Post by: Derek on April 26, 2007, 10:25:06 PM
13 boxes, the script gave the same error
what are you suggesting i do with WinSCP? i have not used it before, are u saying to use that instead of SSH via putty?
Title: Recover Email from SME 6 for use on SME 7
Post by: bpivk on April 26, 2007, 11:59:45 PM
winSCP can browse trough your server (like mc on ssh). You could rename the files yourself. The script does that for you but you could rename the files yourself without the script.

Just change _INBOX_Derek to .INBOX.Derek and do that with all the folders and subfolders (put a . in front of folders and subfolders)
Title: Recover Email from SME 6 for use on SME 7
Post by: william_syd on April 27, 2007, 12:57:46 AM
It's more like a graphical ftp client.

It will show your directories in the right hand side which you can right click and rename. Also right click properties will also let you set the owner of the directory.


Edit: Didn't see the above post.