Migrating Mail Accounts

Posted on 2005-04-05
Last Modified: 2010-03-04

What's the best way to move contents of email accounts from one hosting server to another during migration? By the best way I mean for a administrator who doesn't yet have extensive knowledge of Linux RH.
Question by:Slavyan
    LVL 38

    Assisted Solution

    You need to transfer the mail boxes in /usr/spool/mail from your old box to the new one.
    you can create a tar box in the old box

    cd /usr/spool/mail
    tar cf /tmp/mailbox.tar .

    #Don't a WHTIE SPACE after mailbox.tar following by a DOT.
    then copy mailbox.tar  to your new box, in your new box do:
    make sure there is no duplicate account between old and new box, the the UIDs
    are unique.

    cd /usr/spool/mail
    tar xvf /pathto/mailbox.tar

    then transfer the user account details accross (login name, password and group infor etc), you need to transfer/or merge the follow file under the /etc dir:
     passwd, shadow, group and gshadow

    have a look at the /etc/password file to see where the user's home dirs located, transfer them to the new box as well.

    You need to transfer the user's account accross
    LVL 15

    Accepted Solution

    Hmm - I'd approach this a little differently, as so to overlap services, and not risk email getting stranded.


    (1)  set up a subdomain such as that points to the new server
    (2) setup the new account(s) on the new server
    (3) redirect email from the old account by forwarding to
    (4)move the mx record to point to the new server (i.e. to
    (5) resend the email from the old server to the new one.

     If you are using sendmail on the old server, you resend the email by using the formail command on the old server from your mailbox directory:

    cd /var/spool/mqueue
    formail -f -s sendmail -v -oiee < emailbox

    To automate this, you could set up the full complement of email addresses, and create a small shell script like:


    formail -f -s sendmail -v -oiee $ < $1
    mv $1 old/.

    and then call the script with the argument of the mailbox name.


    Author Comment

    To Yuzh:

    I was thinking more like using a GUI utility you could recommend as I'm not too good at the root level yet. Does any GUI app come to your mind?
    Thank you.

    Author Comment

    To both Yuzh & Periwinkle:

    Guys, can I solve this problem by using Plesk?
    LVL 15

    Expert Comment

    I don't manage servers via Plesk, but I have worked with Plesk accounts.

    I don't know of any functionality in Plesk that will auto-magically move mail accounts for you - sorry.  Have you checked with the documentation here?

    Author Comment

    You know I think it is a solution. There's Migration Manager in Plesk for both domains & accounts.
    So, I'll read into it.
    LVL 15

    Expert Comment

    Slavyan -

    Migration Manager, according to my quick read, was for migrating from a competing product (such as Cpanel)...

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    PRTG Network Monitor: Intuitive Network Monitoring

    Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

    Suggested Solutions

    In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting ( to http…
    Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now