Skip to content

[FAQ] How do i delete all mails except a single domain? #47

Closed Answered by jsuto
Smig0l asked this question in Q&A
Discussion options

You must be logged in to vote

Try the following (be sure to backup the piler database and/or perhaps the whole archive before starting).

Set the retention column for all messages to the past if they are not sent to or received from "domain1", eg.

update metadata set retained=1000000 where id not in (select id from v_messages where fromdomain='domain1' or todomain='domain1');

Then run pilerpurge.py in dry mode, eg.

/usr/libexec/piler/pilerpurge.py -d

It prints a bunch of files and IDs what it would remove from the system. eg.

[1, 2, 18, 20, 21, 22, 23, 39, 40, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, .... 418, 420]

You may check these IDs in the v_messages view in the piler database to ensure that they are NOT from/t…

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
2 replies
@jsuto
Comment options

@jsuto
Comment options

Answer selected by jsuto
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@Smig0l
Comment options

@jsuto
Comment options

jsuto Jun 5, 2024
Maintainer

@Smig0l
Comment options

@jsuto
Comment options

jsuto Jun 6, 2024
Maintainer

@Smig0l
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #46 on May 14, 2024 09:36.