How to Bulk Delete Emails from Your Web Server

Is your mail account filled up with spam and is taking up your disk space? In this post, I will describe how I mass deleted over 24,000 spam emails that went unnoticed and filled up all of my server space through my default email account. Not wanting to fill my email client with such a large number of emails, I used the webmail provided by my cPanel and deleted the emails, using the options given in Squirrelmail.

Now, normally, the easiest way to mass delete bulk emails is to:

  1. Set up the email address in an Email client like Outlook Express
  2. Download all emails into it
  3. Use the search function to quickly locate all the emails received by a certain email address
  4. Select them all and hit DELETE.

But since I did not prefer downloading 24000+ emails to my computer first, I got rid of them directly through the web server. It seemed like a very tedious and never-ending process at first, but I found a couple of ‘Options’ in Squirrelmail (a free webmail client in my cPanel) and got the job done in like 20 minutes. All you need to do is increase the number of emails displayed on one page and delete them all very quickly.

Deleting Mails Using Webmail/SquirrelMail

Here is a step by step breakdown of making bulk deleting of emails easier and quicker:

1. Log in to your Control Panel provided by your webhost. Go to Email Accounts. In my case, it was the ‘default’ account which caught all the mis-directed spam. See the 165 mb size of it?

Email account filled with 170 mb of Spam emails

Email account filled with 170 mb of Spam emails

Now click on the ‘Access Webmail’ or other similar link that your Cpanel might have next to the email account you want to delete emails from.

2. In cPanel, you will see this screen.

 

cPanel's Webmail Login Screen

cPanel’s Webmail Login Screen

Click on ‘Go to Webmail Login’.

3. You will see a screen with a list of all the email programs your cPanel has to offer. I prefer Squirrelmail, but you can tweak the following steps to suit any email program you use.

The webmail Options Screen - Atmail, Horde, RoundCube and Squirrelmail

The webmail Options Screen – Atmail, Horde, RoundCube and Squirrelmail

4. Once inside Squirrelmail, this is what you will see.

Squirrelmail shows15 emails in one page by default

Squirrelmail Interface – It shows15 emails in one page by default

Now if your emails are not as large as mine, in number, you only need a couple of minutes to delete them. If you have only a 1000 emails or so, just click on the ‘Show All’ button under ‘INBOX’ at the top. This will list all the emails at once instead of only 15 per page. Then, click on ‘Select All’ or ‘Toggle All’ button next to it and all the emails will get selected. Next, click on ‘Delete’ on the right side top (under ‘Transform Selected Messages’) and you are done. Each function will take some time, so be patient and let the page load completely before moving to the next action.

This did not work for me as deleting 24000 messages at once (or even displaying them using ‘show all’) was causing an error. So, I started off manually. Very soon, however, I figured out that deleting 15 messages at a time would take me all day (or more) to get this done.

So, here’s what I did next.

5. Go to the ‘Options’ link on the top and click.

squirrelmail Interface - options link

Squirrelmail Interface – Options link

6. You will come to this screen. Click on ‘Display Preferences’.

Squirrelmail Display Preferences

Squirrelmail Display Preferences

7. On the ‘Display Preferences’ options page, scroll down to ‘Mailbox Display Options’ and change the number of emails displayed on each page from the default ’15’ to a number your internet connection can easily handle. A 100 or 500 or a 1000 – like I did.

Squirrelmail Mailbox Display Options

Edit the Squirrelmail Mailbox Display Options

Click on the ‘Submit’ button below and your new settings are saved.

8. Come back to the inbox and you will now see a 1000 messages on each page. Now, repeat the actions in Step 4 i.e. Select All > Delete. In about 20 minutes and 23 steps later, I was done cleaning up my account.

Squirrelmail Inbox showing 1000 emails on one page

Squirrelmail Inbox showing 1000 emails on one page

9. But you are not done yet. The emails are only out of your inbox, not your server. They are still in the ‘Trash’ box and very much taking up the same amount of space on your server. To completely remove them, click on the ‘Purge’ button seen in the left side, blue column. If you do not see a Purge button, click on ‘Check Mail’ below the time in the blue column. That will ‘refresh’ the blue column and the Purge button will re-appear.

Purge Your Deleted Emails

Purge Your Deleted Emails

If you have too many emails to delete, just like me, it would be generally a good idea to hit the ‘Purge’ button every now and then i.e. after 3000-4000 deletions.

There you go! Your space is all cleaned up now. And if you come up with a better idea for doing this, please post in the comments below and share it with other readers in the same predicament.

About Lata Tokhi

Entrepreneur, Webmaster, Writer and Editor with an Experience of over 10 years in Internet Business.

Comments

  1. Whoa… this is the EXACT answer to my problem… thanks so much.

  2. Tim Vaughn says:

    Thank you so much for making this article about bulk deleting emails ! I had almost 30,000 emails to delete. I was able to do it just a few minutes instead of hours and hours it would have taken. I was pulling my hair trying to figure out how to get rid of them because they were wasting disk storage space on my server. They were generated by a “chron” job that ran every few minutes. They went all the way back to the year 2011. I also learned you can redirect the chron job email to nothing by putting ” >/dev/null 2>&1 ” after the chron job line action in the CPANEL advanced settings. Again Thanks for being so thoughtful to post this. Tim

  3. This is the answer, I needed. Thank you very much!

  4. P S Chauhan says:

    Dear Sir,
    Thanks a lot. Your advice helped me a lot in deleting 30,000+ useless mails from my web-server.

  5. This is great. But when you have 326027 emails to clear, you can only sigh. LOL! I didn’t even know there was an email system until today and I am here clicking away. I have 328 (x 2) clicks left!

    Thanks for the tip!!

    Ms Finding Money.

  6. What about 100,000 emails? There has to be a way to do this server level by logging in and removing the contents of the inbox all in one fell swoop? right? If anyone know the exact procedure for this please respond.

    Thanks!

Speak Your Mind

*