The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Restoring single account emails and attachments after deletion

Discussion in 'E-mail Discussions' started by WiredLives, Aug 22, 2016.

Tags:
  1. WiredLives

    WiredLives Registered

    Joined:
    Aug 19, 2016
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Pompano Beach, FL
    cPanel Access Level:
    Website Owner
    Hello all, I am a new poster here.

    I would like to know about the possibility/process of restoring the emails and attachments for a single email account from a cPanel full website backup .

    The scenario is that a user deletes all their emails and attachments AND empties the trash folder.

    There is a previous cPanel full website backup that has been downloaded and extracted to a localmachine/server to recreate the site files, including all email accounts. The local machine can connect to the hosting site with winSCP access to the webhost with a dual panel interface to directories on both systems.

    All hidden files are listed on both systems

    The question is whether replacing the whole directory FROM the backup (overwriting with backup replaced files mode on) on:

    BACKUP_ON_localmachine/homedir/mail/website_name.com/account_to_restore

    over winSCP TO:

    HOST/homedir/mail/website_name.com/account_to_restore

    will actually restore the emails and attachments to the account?

    Though it appears that the logs for the individual account_to_restore are all located in the account_to_restore directory, are there other logs or files in other directories that are required for a restore of just the emails/attachments? I am not trying to delete or recreate the account, and no filenames or passwords are changed.

    The only references I seem to find in a search of the email forums relates to copying specific emails to an account.

    CPanelMichael, April 11, 2011:

    You can find the backup archive from the backup generation date of your choosing, and then manually extract the email contents from the archive (e.g. using the "tar --extract" functionality). The email data is stored in:

    /home/$username/mail/$domain/$email-account-name


    Copying over the extracted data to it's associated directory will not overwrite the new emails that have since generated in the directory, as each email has a unique name.


    Thank you.

    24x7server, April 17 2013:

    Hello [​IMG],

    You have root access of your server so you can restore your mail account sub folder through command line.

    If you have backup in .tar.gz format, then first of all you will have to extract that backup file and rsync your directory which you want to restore from backup to user mail directory.


    The second response seems to indicate that copying the directory to restore the emails would work, but does not refer to the hidden files in the directory.

    Do I specifically need to use rsync for this process or is a manual move with winSCP sufficient?

    I appreciate any and all input here.

    Thank you very much in advance for helping me understand the process.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    Yes, you can simply copy over that directory to the same location under the existing account. It's acceptable to use rsync or a SCP/SFTP client, however ensure you are logged in as the cPanel account username when copying the files. In addition, run the following command via SSH as "root" after copying over the files:

    Code:
    /scripts/mailperm $cpanel-username
    Thank you.
     
  3. WiredLives

    WiredLives Registered

    Joined:
    Aug 19, 2016
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Pompano Beach, FL
    cPanel Access Level:
    Website Owner
    Thank you Michael. I would never have known about the mailperm script.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page