Backup and delete emails from server

TLinger

Member
Sep 15, 2015
9
0
1
Orlando, Florida, USA
cPanel Access Level
Website Owner
Hello,

How can I backup and delete emails via cPanel? The storage capacity for my cPanel account is nearing its limit. Most of this is emails. When I try to compress a folder and download it it only compresses and downloads the folder itself, not the files within the folder. If I select all the files in the mail > cur directory and click compress it seems to compress each file individually. If I select all the files and click download it tries to download all the files individually and freezes my computer up with download dialog boxes. I'm out of ideas on things to try.
 

24x7server

Well-Known Member
Apr 17, 2013
1,911
96
78
India
cPanel Access Level
Root Administrator
Twitter
Hello,

I think when you trying to compress your mail folder that process is not getting complete and due to that you are getting that issues with compress task. Compress process will take some time because there are lot of files in mail directory.

if you getting same issues then you need to contact your hosting support team to make a tar file of your mail directory.
 

Jcats

Well-Known Member
PartnerNOC
May 25, 2011
806
156
168
New Jersey
cPanel Access Level
DataCenter Provider
Do they give you SSH access? If so, you can run:

# cd ~ ; tar -cvf DOMAIN-mail.tar mail/DOMAIN.com/USER/cur

Make sure to replace DOMAIN and USER(email without @domain). This will not use compression so the process will use less CPU which should reduce the chance the process gets killed off. That will make a file called

DOMAIN-mail.tar

in the root of the account so in the folder before 'public_html', you can then download it using FTP/File Manager.
 

TLinger

Member
Sep 15, 2015
9
0
1
Orlando, Florida, USA
cPanel Access Level
Website Owner
I just tried to make a regular tar (not compression afaik) of a folder with only a few files in it. It still only put the folder in the tar file. It shows results instantly, so I don't think its a timeout issue. Also, the folders themselves show that they are only 15-30kb in size even though they contain files that are much larger. Thank you for the help! I will try contacting our hosting provider.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,215
363
Hello :)

You can backup the mail folder via SSH via the "zip" command, download the zip archive, and then delete/re-create the email accounts. You may want to handle the compression on your local machine instead of on the server, or consult with your hosting provider for assistance.

Thank you.