Topic: Moving email between servers? (Page 1 of 1) Pages that link to <a href="http://ozoneasylum.com/backlink?for=29261" title="Pages that link to Topic: Moving email between servers? (Page 1 of 1)" rel="nofollow" >Topic: Moving email between servers? <span class="small">(Page 1 of 1)</span>\

 
zavaboy
Bipolar (III) Inmate

From: f(x)
Insane since: Jun 2004

IP logged posted posted 06-06-2007 05:25 Edit Quote

Ok, here's my issue:

I have a old server running on Red Hat 9 with Plesk (don't like it) and I want to move email from that server to the new server. The new server is Fedora Core 6 with cPanel.

I can't seem to find where the mail is stored. I was thinking I could just move email files from the old server to the new. Am I on the right track?

I was thinking the mail would be in /var/spool/mail but no. I did find the directory /var/qmail/mailnames/zavaboy.com/zavaboy, but I haven't explored it yet. Is this what I'm looking for?

Much help needed. I need to get all 15 domains transfered to the new server before the 20th if possible. I'd like to allow my clients uninterrupted email.

Thank you for any help!

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 06-06-2007 10:37 Edit Quote

Well, one way is always to use imap for that...


There are two common ways to store e-mail on unix boxes: maildir and mbox. Mbox will be a single file for each 'mailbox-directory',
while maildir is a file for each mail...

Either way, the should be in the respective home directory ( /home/user or ~ on the user's shell).

/var/spool/mail is just for undelivered mail...

so long,

->Tyberius Prime

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

IP logged posted posted 06-06-2007 14:53 Edit Quote

Remember as well that Plesk and cPanel are just hosting solutions. What's the actual mail server behind it? Postfix, Exim... which mail server you're actually running will determine how the mail is delivered and in what format. And the two won't necessarily be compatible. You may have to get something to convert the formats.


Justice 4 Pat Richard

zavaboy
Paranoid (IV) Inmate

From: f(x)
Insane since: Jun 2004

IP logged posted posted 06-06-2007 18:21 Edit Quote

TP: I believe I have maildir. Within /var/qmail/mailnames/zavaboy.com/zavaboy I see @attachments and Maildir.

Skaarjj: I don't know the email service on the current server, but here are the most relevant components I found with Plesk:
courier-imap 3.0.8-rh9.build75050128.10
psa-qmail 1.03-rh9.build75050128.10
psa-qmail-rblsmtpd 0.70-rh9.build75050128.10

I think the "psa" part has something to do with Plesk. Is there a way I can tell what email server I have for sure? I do have root shell access.

The new server should have Sendmail 8.13.

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 06-06-2007 18:44 Edit Quote

Then it's simply a problem of copying everything below Maildir into the Malildir on the new host.

You're running qmail for smtp service (mta), and courier to let your users access their mail via imap.

zavaboy
Paranoid (IV) Inmate

From: f(x)
Insane since: Jun 2004

IP logged posted posted 06-06-2007 19:09 Edit Quote

Ok, I'll see how it goes.

I keep forgetting, can I use wget for this? If not, what should I use?

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 06-06-2007 19:44 Edit Quote

huh?

Here's the 'offical way'.
-b) make sure all adresses and so on have been created on the new server.
-a) use 'sendmail' on the new server to localy send a test mail to each account (which will also make sure the maildirs are where they need to be)
a) update dns to point to new mail server
b) Suspend mail server on old server (don't worry, rfc compliant mailservers will try again if they got the old ip due to dns time to live)
c) tar and gzip/bzip (tar -cjf old mail dirs
d) use ssh/sftp to log into new server (from the old one. Yes this means you'll have a ssh connection inside another.) and transfer files
e) ungzip and untar (tar -xjf), this will not override new mails ( filenames in maildir are done via timestamps)


Probably best to keep all imaps shut down during this as not to confuse users ( 'no connection/timeout' is way better than 'hey dude, where are my mails!!!)

So long,

->Tyberius Prime

zavaboy
Paranoid (IV) Inmate

From: f(x)
Insane since: Jun 2004

IP logged posted posted 06-08-2007 02:48 Edit Quote

Ok, after some setting up of the new server, here's how things are:

Old server mailbox:
/var/qmail/mailnames/domain.com/mailuser
Contains: @attachments, Maildir

New server mailbox:
/home/domainuser/mail/domain.com/mailuser
Contains: cur, maildirsize, new, tmp

I would like to make a script that will transfer a single domain and it asks you which mailboxes you would like to transfer. The problem is I don't know SSH that much. I'm probably going to Google everything I want to do in the script and put things together. Then, I'll show you guys to see if it would work ok, I'd hate to screw things up.

If someone is willing to write one for me, let me know.

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

IP logged posted posted 06-08-2007 14:10 Edit Quote

Okay... just a note for you, then. See the Maildir in the Old server? Inside that Maildir is three directories (and maybe a bunch of others, depending on what you're doing for spam filtering andso on). cur, tmp and new. Those are, above all else, what you have to transfer. Also, make sure that their home direcotiries don't contain a .forward file. If they do, you'll have to copy that across too.


Justice 4 Pat Richard

(Edited by Skaarjj on 06-08-2007 14:31)

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 06-08-2007 15:34 Edit Quote

If you don't insist on selecting mailboxes for transfer, it's as easy as

code:
cd /var/qmail/mailnames/domain.com/
tar -cjf 20070608_domain.com.tar.bz2 * -R
sftp otheruser@remoteserver
cd /home/domainuser/mail/domain.com/
put 20070608_domain.com.tar.bz2 
(quit sftp
on the other server
cd /home/domainuser/mail/domain.com/
tar -xjf 20070608_domain.com.tar.bz2


then check if the mails are on the new server...


so long,

->Tyberius Prime

zavaboy
Paranoid (IV) Inmate

From: f(x)
Insane since: Jun 2004

IP logged posted posted 06-08-2007 23:34 Edit Quote

TP: To be honest, I'm mot sure that would work. There is no maildir on the new server. So it would be safer to do each user, yes? On the old server Maildir contains cur, new, tmp (and courierpop3dsizelist which I'm guessing is like maildirsize on the new server) while on the new server those directories are not in a maildir.

Would this work?

code:
// copymailuser.sh domainuser domain.com mailuser
#!/bin/sh
cd /var/qmail/mailnames/$1/$2/Maildir
tar -cjf 20070608_$1_$2.tar.bz2 * -R
sftp otheruser@remoteserver
su
cd /home/$0/mail/$1/$2/
put 20070608_$1_$2.tar.bz2 
bye
// end copymailuser.sh

//on the other server
cd /home/domainuser/mail/domain.com/mailuser/
tar -xjf 20070608_domain.com_mailuser.tar.bz2



Would the su part work? I need root access to get to the directories.



(Edited by zavaboy on 06-09-2007 00:01)

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 06-10-2007 21:32 Edit Quote

no, that won't work.
a) you're placing that tar.bz2 file in /var/qmail/mailnames/$1/$2/Maildir, and you already have to be root to read the maildirs (at least you should be root)
b) cur tmp and new will be created by qmail when delivering the first message - so don't worry about them being missing now.
c) you're writing a bash shell script - it will not pass commands to sftp. You could automate the upload with scp though, I guess.
d) Your taring up the contents of Maildir, but extracting into mailuser... I don' think that's going to work. Do a local mail send
(configure mail on new server. Then do 'sendmail -t myuser@mydomain.com[enter]Test[Enter]Test[Enter].[Enter][Enter]

So long,

->Tyberius Prime

zavaboy
Paranoid (IV) Inmate

From: f(x)
Insane since: Jun 2004

IP logged posted posted 06-19-2007 06:36 Edit Quote

Ok, awhile back TP helped me out over a 2hr chat. We got things figured out. So I tested the move on one of the four mailboxes of a domain. One of the mailboxes can't be accessed, the one I moved. I found that the user/group has been altered on the moved files and directories, so I changed them to what they are supposed to be after looking at the working mailboxes. So now what could the problem be?

Outlook reported:

quote:
Log onto incoming mail server (POP3): Outlook could not connect to the incoming POP3 mail server because the server did not accept your user name or password.


TP: Catch me on ICQ when you get a chance.

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 06-19-2007 09:54 Edit Quote

sorry, won't be on q for at least another 36 hours...

a) you are sure you're connecting to the right (new) server
b) you are sure you're using a username and password that has been assigned on the new server
c) you are sure that in this day and age, you still want to use pop3 to access mail?

zavaboy
Paranoid (IV) Inmate

From: f(x)
Insane since: Jun 2004

IP logged posted posted 06-19-2007 12:02 Edit Quote

a) yes
b) yes
c) explain please

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 06-19-2007 13:57 Edit Quote

Well, for me my own server is mostly the luxury of having my mails everywhere I go, since I store them on the server and access them via imap...


Anyhow, the first place to look would be the log files of whatever pop3 server you're using, and then /var/log/auth to check for the reason of the failed logins...

zavaboy
Paranoid (IV) Inmate

From: f(x)
Insane since: Jun 2004

IP logged posted posted 06-20-2007 15:46 Edit Quote

It actually works... My dad tested it with his MS Outlook, but he said it doesn't work. I tested it in my Thunderbird and it works fine. I didn't do anything with the server.

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 06-20-2007 17:03 Edit Quote

even money on your dad's computer having cached the old dns entry... or you dead has not updated the account settings.

zavaboy
Paranoid (IV) Inmate

From: f(x)
Insane since: Jun 2004

IP logged posted posted 06-21-2007 05:50 Edit Quote

He said it's working now.

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 06-21-2007 12:05 Edit Quote

more evidence for the marvels of the dns system at work...

zavaboy
Paranoid (IV) Inmate

From: f(x)
Insane since: Jun 2004

IP logged posted posted 06-21-2007 16:33 Edit Quote

Now I'll move another domain to see that I have the procedure down pat.



Post Reply
 
Your User Name:
Your Password:
Login Options: Remember Me On This Computer
 
Your Text:
Loading...
Options: Show Signature
Enable Slimies
Enable Linkwords

« BackwardsOnwards »

Show Forum Drop Down Menu