Anne,

This should get you going:

update
        dbmail_messages m, dbmail_physmessage p
set
        m.status=2
where
        m.physmessage_id=p.id
        and     p.internal_date < 2005-01-01;


Of course this will set all messages before jan 1st to DELETE, so you'll have to tweak this query to select only certain mailboxes:

update
        dbmail_messages m, dbmail_physmessage p, dbmail_mailboxes b
set
        m.status=2
where
        b.name = "INBOX"
        and     b.owner_idnr=1
        and     b.mailbox_idnr = m.mailbox_idnr
        and     m.physmessage_id=p.id
        and     p.internal_date < 2005-01-01;

After running this query messages will still be in the database. That is, until after you run 'dbmail-util -y -p'



Anne Strikwerda wrote:
Hi,

Has anyone figured out a query to delete mail of x days and older from a
mailbox? I'm using 2.0.4.

thanks,
Anne

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


--
  ________________________________________________________________
  Paul Stevens                                         [EMAIL PROTECTED]
  NET FACILITIES GROUP                     GPG/PGP: 1024D/11F8CD31
  The Netherlands_______________________________________www.nfg.nl

Reply via email to