Connect. Communicate. Collaborate. Securely.

Home » Kerio User Forums » Kerio Connect » How to delete a mail from the linux console?
  •  
jandoemen

Messages: 36
Karma: 0
Send a private message to this user
I'm looking for a way to delete messages from the /store with a script. Here is why:

I get several hunderd spams a day and most of them are going neatly into the junk-mail. No problem there. But I have to check for false positives too and it takes me a lot of time to look through the obvious spam messages over and over again.

My idea was to create a script so I can delete obvious spam from the junk-mail folder. e.g. I would use something like:

egrep -Lir ^To: .|xargs rm

This would remove all messages that does not contain a To: field.

I tried this and it works, the messages are gone but I guess thats not enough. I noticed that several files are changed when I delete a message normally (deleted.fld, index.fld, search.fld, sort.fld and status.fld).

The question: what command do I use to delete a message from the Linux console? or what steps should I take to accomplish this like => delete message and then rebuild these file with comand xxx.

Hope there is a solution for this.

Thanks in advance.
Jan
  •  
winkelman

Messages: 2119
Karma: 3
Send a private message to this user
Simple answer: don't mess with the store.

Difficult answer: delete the messages, delete the index files, stop KMS, start KMS (it will then rebuild the index files, but lose flags doing so (such as read/unread, flagged, etc.).
  •  
Pavel Dobry (Kerio)

Messages: 5245
Karma: 251
Send a private message to this user
winkelman wrote on Sun, 04 December 2005 14:54

Simple answer: don't mess with the store.

Difficult answer: delete the messages, delete the index files, stop KMS, start KMS (it will then rebuild the index files, but lose flags doing so (such as read/unread, flagged, etc.).


You will not lose flags if you rename index file from index.fld to index.bad instead of deleting this file. KMS will recover flags for existing messages from the .bad file.
  •  
jandoemen

Messages: 36
Karma: 0
Send a private message to this user
Thanks already guys but is't there a less drastic method instead of stopping the kerio server? A rebuild command or so?

I tried to delete all mails without a To: address and it worked. The only problem I had was when I sorted the messages on To: address. When ordering on another field all worked OK. After checking the mails I deleted all messages (right click on folder => delete all) and everything is OK again. I asume this will rebuild the index too.

Greetz
Jan
  •  
winkelman

Messages: 2119
Karma: 3
Send a private message to this user
Quote:

You will not lose flags if you rename index file from index.fld to index.bad instead of deleting this file. KMS will recover flags for existing messages from the .bad file.

Wow, didn't know that. That's a nice 'feature'... :-)
  •  
winkelman

Messages: 2119
Karma: 3
Send a private message to this user
jandoemen wrote on Sun, 04 December 2005 18:56

Thanks already guys but is't there a less drastic method instead of stopping the kerio server? A rebuild command or so?

I tried to delete all mails without a To: address and it worked. The only problem I had was when I sorted the messages on To: address. When ordering on another field all worked OK. After checking the mails I deleted all messages (right click on folder => delete all) and everything is OK again. I asume this will rebuild the index too.

Greetz
Jan


The 'official' way of reindexing folders is to first stop the server, then rename the index and then start the server.

But in my experience you don't need to stop the server. When I reindex a folder I just make sure the user is not logged in. KMS will reindex once the user opens a folder with a missing (renamed) index file. Since all our company is on webmail, stopping the server to reindex a folder is not really an option... (Luckily I very very rarely need to reindex a folder, a couple of times a year.)
  •  
jandoemen

Messages: 36
Karma: 0
Send a private message to this user
Do you know by any means know another way to accomplish what I want to do?
  •  
winkelman

Messages: 2119
Karma: 3
Send a private message to this user
AFAIK there no API or command line interface to directly give KMS instructions to (for example) delete messages.

For exact answers you're best of calling support directly...
  •  
Kerio_ktrumbull

Messages: 597
Karma: 2
Send a private message to this user
Officially yes, stop the mail server, re-index, and restart the mail server.

Unofficially, you do not need to stop the mail server, and actually the user does not need to logout. Simply rename the index.fld to index.bad at any time, then the next time an Inbox folder is loaded, it will give a message stating that the folder is being re-indexed. Simply refresh the folder and it will be done re-indexing. The MailServer looks at the index.fld every time a folder is opened, and when it doesn't see it, it will re-build it.

Kevin Trumbull
Kerio Technical Support Team Leader
http://support.kerio.com
Previous Topic: Adding users/domains to internal database with external app
Next Topic: traffic chart
Goto Forum:
  


Disclaimer:
Kerio discussion forums are intended for open communication between forum members and may contain information and material posted by members which may be useful in learning about Kerio products. The discussion forums are not intended to provide technical support for any specific product. Any information implied or expressed in the discussion forums is that of the posting member. Kerio is in no way responsible for the information posted in the forums, or its accuracy. Kerio employees may participate in the discussions, but their postings do not represent an offical position of the company on any issues raised or discussed. Kerio reserves the right to monitor and maintain the forums to promote free and accurate exchange of information.

Current Time: Sun Nov 19 19:08:41 CET 2017

Total time taken to generate the page: 0.00563 seconds
.:: Contact :: Home ::.
Powered by: FUDforum 3.0.4.