HSPComplete mbox hack

Today I faced an interesting issue on a HSPComplete box. One of the customer was unable to pop emails from an account. There was no issue with the pop service but I used to get a ERR message after the authentication.

Following is the pop test via TELNET

$ telnet localhost 110
Trying 127.0.0.1…
Connected to testserver (127.0.0.1).
Escape character is ‘^]’.
+OK
user testuser
+OK
pass 123456
-ERR
Connection closed by foreign host.

Log was showing the following message :

Jul 22 22:48:29 testuser popa3d[10007]: Failed or refused to load /var/spool/vmail/testdomain.com/mail/testuser

Here is the pop3d rpm which was found on the server :

popa3d-0.6.4-4.as3.swsoft

Trouble shooting :

Checked inbox for multiple email accounts The mbox file size didn’t affect other email accounts found to be having more emails than this account.

There were no complaints from other customers.

File permissions for the inbox found to be fine along with the ownership etc.

Took a backup of the inbox and emptied it to check if I can successfully login to pop account. That did a trick. But that was not the complete solution.  Customer wanted to pop all his 40k+ emails. I tried to split the mbox file into 50MB chunks, copied the content of the first part to inbox and tried popping the emails. Still there was no luck.

Work around :

While working with the inbox file I found that something is wrong in the first line. I found some content which might have been the subject line of the first message. It means the mbox file is corrupted. When we use mbox format to store emails on the server all the emails coming to an email account will be stored in a single file and the file might get corrupted while popping the emails etc…

I just removed the first email from the mbox file (You can identify the different emails as the email content is stored in plain text and also there will be a line which indicates the beginning of a new message. Its quite easy to understand how emails are stored in mbox file once you look into it) and customer was able to start popping emails without any issues.

You might face this issue on servers using mbox format for inbox. Many plesk, cpanel as well as HSPComplete boxes are still using mbox. Hope this post will help you resolve such issues.

PS: Ensure that you’re using mbox file format. In maildir format you will have cur, new and tmp folders for each account.

Following links will help you understand the MailBox formats better

http://en.wikipedia.org/wiki/Maildir

http://en.wikipedia.org/wiki/Mbox

Also check the following posts

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.