How to access and manage a large mailbox (11 GB)

emailsendmail

I've inherited a server which on the whole has been very well maintained. There are a few oddities which are no doubt the result of some executive decision taken by "someone who is not here now".

One of them is the way email is used most of the system notices are fired off as emails. This has for reasons that I'd rather not get into left the server with a large mail box which contains probably a lot of junk but also some important information as it was used as a catch all to allow for impromptu email address creation.

This mailbox is just shy of 11 GB and clearly needs to be sifted through. However the scripts that are supposed to help me do that crash because of the size of the box.

This is not my area of expertise and I'm really not sure what I could be doing to deal with this but all the while I wait the file gets bigger.

The file is according to Webmin at /var/spool/mail/[username].

Trying to read it or even the list of all inboxes returns errors like this one:

HTTP/1.0 500 Perl execution failed Server: MiniServ/1.670 Date: Mon, 2 Jun 2014 15:22:11 GMT Content-type: text/html; Charset=iso-8859-1 Connection: close
Error – Perl execution failed
sdbm store returned -1, errno 22, key "332567" at /usr/libexec/webmin/mailboxes/boxes-lib.pl line 328, line 1213158.

The server is sendmail and the POP3/IMAP is dovecot. I'm running CentOS 5.10.

I have root access and the freedom to do whatever needs doing provided I do not take any of the live services down when I do it but that does not help when I'm unsure how to get into said file and deal with the mass of mail.

I do not have physical access to the box but am not afraid to use PuTTY and control it that way.

I thought I'd use POP3 and empty the box to a desktop PC but the connection times out because it is too big. I should have seen that coming I guess.

Is there something I can use to help me get to grips with this issue?

Best Answer

I would open the file directly in mutt using this command and just start selecting and deleting messages that are of no consequence to get the size down.

$ mutt -f /path/to/inbox

Example

$ mutt -f /var/spool/mail/[username]

Mutt has the ability to tag messages based on patterns so I'd use this feature and try and select large groupings of messages and then delete them.

References

Related Question