beware!
study ur local law or get a lawyer at your side and let check ur country law for this. in germany the privacy is protected - even for emails. if you delete ANY mails - even if they are in the trash folder - you brake the law. in fact in germany it is a crime!
not everything which is possible is making sense too. ;)

regards
Simon

Micah Stevens wrote:

HI,

My users never empty their trash, in some cases the user would have a couple of megs of current mail, but over 300 megs in their trash can. This all adds up of course, so I came up with a query to delete items in any mailbox labeled 'Trash' that is over 30 days old. I figured this is a safe method.

This has not been tested very much, so if it hoses your database, it's not my fault. I have run it on my test system a couple of ways, and also once on my production database, and I had no problem. This just updates the deleted flag, so if it eats up the wrong messages, you can just restore them by changing the deleted flag. Also, this is for a 1.x database, I think it would still work on 2.x, but I didn't consider this at all, so be warned. I'm going to set this up as a cron job to run once a week to solve my problem. Here's the SQL:
UPDATE mailboxes
  LEFT  JOIN messages
USING ( mailbox_idnr ) SET messages.status = 2 WHERE messages.internal_date < DATE_SUB(CURDATE(), INTERVAL 30 DAY)
  AND messages.status <= 1
  AND mailboxes.name LIKE 'Trash'


HTH,
-Micah _______________________________________________
Dbmail mailing list
[email protected]
https://mailman.fastxs.nl/mailman/listinfo/dbmail

--
Simon Lange                Director
[EMAIL PROTECTED]
===================================
PolyNature Design           Limited
 Lueneburger Str 15
 DE-21360 Voegelsen
 Germany

 FON  +49 [0]4131 220121
 FAX  +49 [0]4131 224730
 CELL +49 [0]160 903 000 77
 LONDON OFFICE +44 [0]20 7127 6332
===================================
Consulting  Management  Development
Hosting   Administration    Housing
-----------------------------------
If you wish ENCRYPTED mails, ensure
you have a certified signature and
our public key. You can get both at
https://www.trustcenter.de for free

begin:vcard
fn:Simon Lange
n:Lange;Simon
org:PolyNature Design
adr:;;Lueneburger Str 15;Voegelsen;NDS;21360;Germany
email;internet:[EMAIL PROTECTED]
tel;work:+44 (0)20 71276332
tel;fax:+49 (0)4131 224730
tel;home:+49 (0)4131 220121
tel;cell:+49 (0)160 90300077
note;quoted-printable:Consulting=0D=0A=
	Management=0D=0A=
	Development=0D=0A=
	Hosting=0D=0A=
	Administration=0D=0A=
	Housing
x-mozilla-html:FALSE
url:http://www.polynaturedesign.com
version:2.1
end:vcard

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to