# Maintenance: scheduled tasks

Mail Log comes with maintenance tasks that run through the Joomla task scheduler. They keep the database lean, maintain the statistics and carry out one-off conversions. None of these tasks runs by itself — you set them up in the task scheduler.

## Setting up a task

1. Open *System → Manage → Scheduled Tasks* and click *New*.
2. In the selection dialogue, choose one of the Mail Log task types (see the table).
3. Give it a name, set the interval under *execution rules* (daily, for example) and save.
4. Enable the task. For scheduled tasks to actually run, the Joomla scheduler has to be triggered — by a website visit (the default) or by a real cron job.

<figure id="bkmrk-the-mail-log-task-ty"> ![The selection dialogue for new scheduled tasks with the Mail Log task types](https://docs.graup-it.de/uploads/images/gallery/2026-08/TV1doku-09-tasks.png) <figcaption>The Mail Log task types in the task scheduler.</figcaption></figure>## The task types

<table class="table" id="bkmrk-taskpurpose-clean-up"> <thead> <tr><th scope="col">Task</th><th scope="col">Purpose</th></tr> </thead> <tbody> <tr><td>**Clean up old log entries**</td><td>Deletes entries older than the configured retention and enforces the maximum number of entries (FIFO). Batched, so that even large tables are processed gently.</td></tr> <tr><td>**Clean up attachment files**</td><td>Removes orphaned attachment files (whose entry was deleted) and files older than the attachment retention.</td></tr> <tr><td>**Update daily statistics**</td><td>Maintains the pre-aggregated daily figures for the dashboard. Only needed if you have set the statistics mode to *task*.</td></tr> <tr><td>**Clean up old mail bodies**</td><td>Resets the text of old entries and keeps only the metadata. Only effective with the storage mode "full, deleted automatically after N days".</td></tr> <tr><td>**Migrate legacy-encrypted bodies**</td><td>A one-off conversion: re-encrypts entries from an earlier version to the current method and removes the old key once nothing depends on it any more. Run it until no legacy entries are reported.</td></tr> <tr><td>**Move attachment files**</td><td>A one-off conversion: moves attachments from an old storage location (inside the web root) to the safe default location. Run it until no files are left.</td></tr> </tbody></table>

## Recommendation for regular operation

For most websites two daily tasks are enough:

- **Clean up old log entries** — keeps the table within bounds.
- **Clean up attachment files** — only needed if you capture attachments.

The two migration tasks (*migrate legacy-encrypted bodies*, *move attachment files*) are only needed if you updated from a very early version. Once the migration is done you can disable or delete them. *Update daily statistics* and *clean up old mail bodies* only make sense with the matching settings.

<div class="callout info" id="bkmrk-all-cleanup-tasks-wo">All cleanup tasks work in blocks and with clear upper limits, so that they do not overload the server even with very large data sets.

</div><small>Applies to version 1.0.5.</small>

[Deutsche Fassung](https://docs.graup-it.de/link/88)