How to purge old emails via CLI

Description
This article details how an administrator can remove emails older than a
specified date using the Command Line Interface.
Resolution
IMPORTANT: Using the below purge commands will result in data removal. To
avoid any data loss we strongly suggest that a full backup of the domain /
account, ailment on which the purge will be applied, should be performed before
performing the purge procedure.

To use the purge commands connect to the CLI interface using telnet:

telnet 7000
user admin admin_user_pa$$w0rd
For a list of available commands, type HELP
+OK: Authentication successful
<#>

Here, in the general context you have the command:

PURGE public|account folders [, ]*
[] – purge mails from specified folders of all users from
all enabled domains

WARNING: If you use the command at this level it will apply the purge on
ALL the enabled domains and their accounts.

Example of running the command:
<#> PURGE account folders Trash,Spam BEFORE 3w

This will remove all the emails with the internal date older than three
weeks.

You can also use this command at domain level, thus applying the command
for *ALL* accounts in *ONLY* that domain or at account level thus applying
the purge for that specific account.

NOTES:

1) There are some implicit constraints, applied by default, that are meant
to prevent any accidental data loss. Any purge Condition you put for the
command will be applied after a logical & (AND) is made with the following
implicit conditions:

Purge folders = (Spam Trash)
Purge condition = (BEFORE 2w)
These can be edited on a domain level via the CLI domain context:

<#> update domain domain.test
config adminlimits
and the commands:
SET [purgeConstraint ] – set the implicit purge condition
constraint
SET [purgeFolders (list of purgeable folders)] – set the implicit purge
folder constraint
2) In any context of the CLI interface you can type *help* to obtain a list
of all the available commands.

Revisions

No comments yet.

Leave a Reply