---
name: "dbmail-util"
section: "8"
platform: "linux"
package: "dbmail"
version: "3.5.6-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/dbmail-util"
---

# dbmail-util(8)

maintains the integrity and cleanliness of the DBMail datatables.

## NAME

dbmail-util - maintains the integrity and cleanliness of the DBMail datatables.

## SYNOPSIS

```
dbmail-util [options] --all-checks
dbmail-util [options] --test-integrity
dbmail-util [options] --check-body
dbmail-util [options] --purge-deleted
dbmail-util [options] --set-deleted
dbmail-util [options] --clear-replycache time
dbmail-util [options] --clear-iplog time
dbmail-util [options] --rehash
```

## DESCRIPTION

The dbmail-util program offers a database cleanup and integrity check. All messages set for deletion (status 2) will be marked for final deletion (status 3). All message marked for final deletion will be cleared from the database. The integrity check will check for unconnected mimeparts, headervalues, messages and mailboxes.

By default, checks are read-only. Pass the --no option to respond no to any prompts. Pass the --yes option to make read-write changes, responding yes to any prompts.

## OPTIONS

- \-b, --check-body

  Check and rebuild the body/header/envelope cache tables.

- \-d, --set-deleted

  Queue all messages marked with the DELETE (2) status for final purging, by setting the status value to PURGE (3). The status field is set to DELETE by either the IMAP-EXPUNGE or POP3-DELE commands.

- \-p, --purge-deleted

  Remove all messages with a PURGE (3) value on status field. To purge messages currently marked with the DELETE (2) status, run with the -pd options twice. This is not recommended; it is better to leave a grace period for old messages before permanently wiping them from the database.

- \-s, --remove-invalid-aliases

  Remove dangling/invalid aliases and forwards.

- \-t, --test-integrity

  Test for message integrity.

- \-a, --all-checks

  Perform the above checks: --check-body --set-deleted --purge-deleted --remove-invalid-aliases --test-integrity

- \-r, --clear-replycache time

  Clear the reply cache used for autoreplies and Sieve vacations. The time is specified as \<hours\>h\<minutes\>m (don’t include the angle brackets, though!).

- \-l, --clear-iplog time

  Clear the IP log used for IMAP/POP-before-SMTP. The time is specified as \<hours\>h\<minutes\>m (don’t include the angle brackets, though!).

- \--rehash

  Rebuild hash keys for stored messages

- \--erase days

  Delete messages older than date in INBOX/Trash

- \--move days

  Move messages from INBOX to INBOX/Trash

- \--inbox name

  Inbox folder to move from, used in conjunction with --move

- \--trash name

  Trash folder to move to, used in conjunction with --move

**Common options**

- \-n, --no

  Show the intended repairs without making any changes, i.e. no to all.

- \-y, --yes

  Perform all repair actions , i.e. yes to all.

**Maintenance options**

- \--rehash

  Rebuild the hash values for all the message parts in the database. You need to run this after modifying the hash\_algorithm config option.

- \-e, --check-empty-cache

  Check for empty envelope cache.

**Migration options**

- \-M, --migrate-legacy limit

  migrate legacy 2.2.x messageblks to mimeparts table.

- \-m, --migrate-limit limit

  limit migration to \[limit\] number of physmessages. Default 10000 per run.

## COMMON OPTIONS

- \-f, --config configfile

  Specify an alternate config file.

  Use dbmail-\<utility\> --help to show the default location.

- \-q, --quiet

  Quietly skip interactive prompts and helpful status messages which would otherwise be printed to stdout. Use two -q’s to silence errors which would otherwise be printed to stderr.

- \-v, --verbose

  Operate verbosely. Some of the utilities in the DBMail suite can take two -v’s for extra verbosity. Those which don’t understand this convention won’t complain about having the extra -v and will simply operate at their normal verbosity.

- \-V, --version

  Show the version and copyright, then exit.

- \-h, --help

  Show a brief summary of options, then exit.

## RETURN VALUES

Returns 3 when errors are found but could not be fixed due to failure, 2 when errors are found but *-y* was not provided or *-n* was provided, 1 when errors are found and fixed successfully, 0 when no errors are found.

## EXAMPLES

Regular maintenance can be run as a regular cron job:

```
dbmail-util --all --yes --verbose
```

To set all messages with the DELETE status to PURGE status, and permanently remove all messages previously set to PURGE status:

```
dbmail-util --set-deleted --purge-deleted -yes
```

To get a listing of the changes that would be performed for all actions:

```
dbmail-util --all --no
```

To remove all IP log entries more than three days old:

```
dbmail-util --clear-iplog 72h --yes
```

After upgrading from DBMail 2.0 or truncating the cache tables, run this command to populate the cache:

```
dbmail-util --check-body --yes
```

## SEE ALSO

[dbmail(1)](/dbmail/1.md), [dbmail.conf(5)](/dbmail.conf/5.md), [dbmail-deliver(1)](/dbmail-deliver/1.md), [dbmail-export(8)](/dbmail-export/8.md), [dbmail-httpd(8)](/dbmail-httpd/8.md), [dbmail-imapd(8)](/dbmail-imapd/8.md), [dbmail-lmtpd(8)](/dbmail-lmtpd/8.md), [dbmail-pop3d(8)](/dbmail-pop3d/8.md), [dbmail-sieved(8)](/dbmail-sieved/8.md), [dbmail-sievecmd(8)](/dbmail-sievecmd/8.md), [dbmail-users(8)](/dbmail-users/8.md), [dbmail-util(8)](/dbmail-util/8.md)

## BUGS

For the latest announcements, please subscribe to the **DBMail announce mailing list**\[1\]

For general discussion, please subscribe to the **DBMail general mailing list**\[2\]

If you experience an issue with DBMail, please report it on the **DBMail Bug Tracker**\[3\]. It may be helpful to have a debug log available.

## LICENSE

DBMail and its components are distributed under the terms of the GNU General Public License Version 2. Copyrights are held variously by the authors listed below.

## AUTHOR(S)

DBMail is a collaborative effort among the core developers listed below and the tremendous help of the testers, patchers and bug hunters listed in the AUTHORS and THANKS files found in the DBMail source distribution.

```
Alan Hicks          Persistent Objects Ltd https://p-o.co.uk
Eelco van Beek      Aaron Stone            Paul J Stevens
Roel Rozendaal      Open Source Engineer   NFG Net Facilities Group BV
Ilja Booij          Palo Alto, CA USA      http://www.nfg.nl
IC&S                                       http://www.ic-s.nl
```

## AUTHOR

**Alan Hicks** \<ahicks@p-o.co.uk\>

Author.

## NOTES

- 1\.

  DBMail announce mailing list

  https://dbmail.org/wws/info/dbmail-announce/

- 2\.

  DBMail general mailing list

  https://dbmail.org/wws/info/dbmail-general/

- 3\.

  DBMail Bug Tracker

  https://github.com/dbmail/dbmail/issues
