Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Importing Email Accounts

Discussion in 'E-mail Discussion' started by b1ackjosh, Sep 28, 2010.

  1. b1ackjosh

    b1ackjosh Registered

    Sep 23, 2010
    Likes Received:
    Trophy Points:
    I would like to find a way to create email accounts via SSH.
    More specifically, I get clients who want to import email accounts an their messages from one cPanel server to another. Usually this isn't possible without using a CPmove file and the restorepkg script. Is there a way to do that only using ssh?
  2. cPanelJared

    cPanelJared Technical Analyst

    Feb 25, 2010
    Likes Received:
    Trophy Points:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    cPanel e-mail accounts have their username, password and quota information stored in files in the following directory format:



    • $HOME = the home directory;
    • $USER = the cPanel account user, and;
    • $DOMAIN = the domain for the e-mail account.

    Within that directory, passwd, shadow and quota are the files that need to be copied over. All three files are in plain ASCII text format, so you can copy and paste entries from them if needed. There will also be a ",v" file for each file. This is an RCS revision log, and it does not necessarily need to be copied.

    The mail data themselves are stored in the following directory structure:



    • $HOME = the home directory;
    • $USER = the cPanel account user;
    • $DOMAIN = the domain for the e-mail account, and;
    • $EMAILUSER = the username portion of the e-mail address.

    $EMAILUSER is a directory, and it contains all of the mail for that particular mailbox within its subdirectories. Messages that have not been read yet are in the new subdirectory, and messages that have been read are in the cur subdirectory. There are additional subdirectories for IMAP folders that have been created. Each mail message is stored in a single text file.

    If you copy e-mail accounts manually to another server, you will want to move /$HOME/$USER/.cpanel/email_accounts.yaml and /$HOME/$USER/.cpanel/email_accounts.cache so that they will be regenerated the next time you log into cPanel as the account user. Moving the files will force cPanel to re-read the passwd and shadow file for the account and correctly populate the email_accounts.yaml file.
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice