Hi,

a simple version could be:
SELECT * FROM `dbmail_physmessage` p WHERE id IN (SELECT physmessage_id
FROM `dbmail_messages` m
WHERE mailbox_idnr
IN (
SELECT mailbox_idnr
FROM `dbmail_mailboxes` ma
WHERE `name` LIKE 'TRASH'
)
)
and
internal_date < date_sub(NOW(), interval 1 year);


It uses internal_date of the physmessage I think thats the date the mail arrives at dbmail.

Deleting should be done per update the message table deleted_flag column and the temp table.

And then wait for the dbmail_util cronjob.

regards

Harald

PS: its only a quick shoot and could be completly wrong....

Am 10.01.2013, 18:57 Uhr, schrieb Reindl Harald <[email protected]>:

hi

has someone a queray in the background who finds all
messages of any user in folders called "Trash" which
are older than 365 days?

many users do not recognize that "delete" on IMAP
is not really delete and i would like to get free
the wasted space to reduze storage size / backup-times
and prevent inndob files growing more an more at all



--
Harald Leithner

ITronic
Vogelweidplatz 12, 1150 Wien, Austria
Tel: +43-1-786 23 88
Fax: +43-1-98 52 077
Mobil: +43-699-123 78 4 78
Mail: [email protected] | itronic.at
_______________________________________________
DBmail mailing list
[email protected]
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail

Reply via email to