delete manually mails

Use this forum if you have installed hMailServer and want to ask a question related to a production release of hMailServer. Before posting, please read the troubleshooting guide. A large part of all reported issues are already described in detail here.
Post Reply
evb
New user
New user
Posts: 13
Joined: 2008-11-05 09:33
Location: Belgium

delete manually mails

Post by evb » 2008-11-05 09:56

Data directory synchronizer program.
If I did understand correctly the working of this program, it works only in one way
--> it scans the data directory and if it finds a email not mentioned in the hm_message table, it adds it to the table.

Is there existing a tool who does the opposite?
It scans the hm_message table and if the correcsponding email file is not existing in the data directory, it deletes the line from the table.

My problem is too many mails for the squirrelmail webclient, it times out. (error in imap_general.php on line 92 and in the webbrowser connection dropped by the IMAP server)
I found out that the 28/10 I did receive 3000 spams mails by querying the database.
I deleted already a 1500 mails manually using the windows search engine on "Subject : [SPAM]"
--> deleted all found mails in the datadirectory
--> deleted all rows in hm_message for the 28/10
--> did run the data directory synchronizer
==> it did recreate the records for the 28/10 still existing in the data directory
But now I have still a 1500 mails not detected by the spam filter in hmailserver :-(
I could write a query to give me all mails with a FROM domain name not known by me = this means SPAM mails
The others are then the normal emails.

But deleting these rows will not delete the files in the datadirectory...
And do it one by one, pfff :-(

PS : using hmailserver 5, php 5 and squirrelmail 1.4.14

evb
New user
New user
Posts: 13
Joined: 2008-11-05 09:33
Location: Belgium

Re: delete manually mails

Post by evb » 2008-11-05 11:59

Sorry, correction the version hmailserver is 4.4.1
hmailserver 5.3.3-B1879
MySQL server Ver 5.5, for Win32

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: delete manually mails

Post by ^DooM^ » 2008-11-05 12:01

If you know PHP you can recurse through each directory on the server and check against the database hm_messages with a simple SQL statement, if filename does not exist in array, delete record from database.

Just backup database first yeah :)
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

evb
New user
New user
Posts: 13
Joined: 2008-11-05 09:33
Location: Belgium

Re: delete manually mails

Post by evb » 2008-11-05 13:04

did program in php several years ago, so not impossible, but will take long to do :-(
(don't have the php dev environment anymore, the knowledge about the used syntax is gone, ...)

Because I don't have access anymore to my mails, and it becomes urgent, I will try other solutions that I read about in the forum.
for example try to use outlook, maybe outlook will not give me a timeout ;-)

So my first concern, again my mail up and running.
hmailserver 5.3.3-B1879
MySQL server Ver 5.5, for Win32

User avatar
mattg
Moderator
Moderator
Posts: 20272
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: delete manually mails

Post by mattg » 2008-11-05 13:13

Definitely backup first as ^doom^ says.

This may help
http://www.hmailserver.com/forum/viewto ... 14&t=10062
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

evb
New user
New user
Posts: 13
Joined: 2008-11-05 09:33
Location: Belgium

Re: delete manually mails

Post by evb » 2008-11-05 13:32

At first look, this is what I want :-)
Will give it a try this evening.

thanks a lot for pointing this to me.
hmailserver 5.3.3-B1879
MySQL server Ver 5.5, for Win32

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: delete manually mails

Post by ^DooM^ » 2008-11-05 13:41

I thought of that script to matt but it is the wrong way round.

"Anyway, here is a Description of the script:
It makes a recursive list of a given directory (usally where you store the *.eml files :)) and then it compares to the filenames that are stored in the hmailserver database. If there is a mismatch the file will be renamed to *.deleteme "

It renames files on the server, not removes entries from the database although you could maybe edit it to work the opposite way.
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

User avatar
mattg
Moderator
Moderator
Posts: 20272
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: delete manually mails

Post by mattg » 2008-11-05 13:52

evb wrote:I could write a query to give me all mails with a FROM domain name not known by me = this means SPAM mails
The others are then the normal emails.

But deleting these rows will not delete the files in the datadirectory...
And do it one by one, pfff :-(
Sorry, I read this as user could delete from database, but just couldn't find the files easily to delete the files too.

I figured that both would need to occur (but didn't state that)

Matt
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: delete manually mails

Post by ^DooM^ » 2008-11-05 14:08

guess it could be read both ways :D
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

Post Reply