Page 1 of 1

A bit of a mess

Posted: 2015-02-13 12:44
by SniffTheGlove
Hello All,

I have made a bit of a mess with my hMailserver data and need some help to clear it up.

I was trying to write a new function in the EventHandler.vbs to forward certain emails to a spam email account on my internal domain mail.localhost. The trouble was I sent a test message and the next thing I have 90,000 duplicated test messages in the account spam@mail.localhost.

If I try an use a mail client to view the account then it takes hours to load up and then ages to make one change let alone delete 90,000 emails.

So I ran a dos script to remove basicly delete all files created that day to delete the rogue test files. This worked a treat and I am back down to the usual 2500 proper spam emails that should be in the account.

However when I now run a mail client to view these 2500 files hMailServer is still telling the client there is 90,000 emails and takes hours still. I think it is getting the data from the DB.

I have had a look at the DDS addon and this appears to put surplus eml files into the DB.

Is there a way to get hMailserver to delete DB records where there are no associated eml file in the directories.

Thanks

Re: A bit of a mess

Posted: 2015-02-13 12:49
by percepts
Do a restore from a backup before you messed up.

Re: A bit of a mess

Posted: 2015-02-13 13:07
by percepts
And if that is just a spam folder or spam only account then you can either delete the folder or delete the account and recreate it.

Re: A bit of a mess

Posted: 2015-02-13 13:23
by mattg
In the account, under the advanced tab there is an empty account button

Re: A bit of a mess

Posted: 2015-02-13 13:31
by jimimaseye
Sniff, run this: viewtopic.php?f=20&t=27646&p=170991#p170991

to delete from the database the references to the emails that no longer exist. That hopefully will bring your database to only possess references to the EXISTING real emails that are on disk.

Re: A bit of a mess

Posted: 2015-02-13 13:43
by SniffTheGlove
Thanks for the replies.

I wanted to keep the main spam emails in the account for Spamassassin to work with.

I ran that script that jimimaseye and everything worked brilliant.

Thanks all, a sigh of relief

Re: A bit of a mess

Posted: 2015-02-13 14:31
by jimimaseye
Great. Out of interest how long did it take to run?

Re: A bit of a mess

Posted: 2015-02-17 09:03
by SniffTheGlove
I can not remember sorry.

Just set it running and left it.

I have also added some modifications to your you code (see your other post) to take into account undeliverable messages that hMailServer recreates.

Re: A bit of a mess

Posted: 2015-02-17 11:22
by jimimaseye
Those undeliverables were are consequence of your original script creating the duplicates spam mails and not the script I quoted used to delete them. The script I posted does not create 'undeliverables' as its not deleting .EML files which is what the undeliverable message is complaining about (it simple deletes records from the database). Those undeliverables were more likely because you manually deleted the .EML files (as you said earlier) but the server was in the process of going through its database trying to process them. (ie, youve created the 90000 thousand copies, hmailserver starts to go through and starts to process the 90000, you then manually delete the .EML, them hmailserver came across and says "Oi! Where is the .EML file gone?"