# Captured mail

> The mail your Hub keeps for rules (captured, redirected and deleted-for-good messages), how it is stored and encrypted, how long it is kept, and how to read, download, restore or delete it.

Source: https://docs.posternmail.app/rules/captured-mail/

When a rule takes a message out of your mailbox, the Hub keeps a copy first. This page explains
what is kept, how it is protected, for how long, and how you get a message back. Open the list
under **Settings → Captured mail**. The page says "Mail your rules took out of a mailbox and kept
on your Hub. Read it, download it, or put it back."

## What is kept, and for how long

| Kind | Filter | Comes from | Kept |
|---|---|---|---|
| Captured | **Captured** | The [Capture](https://docs.posternmail.app/rules/steps/#capture) step | Until you delete it ("Kept until you delete it") |
| Redirected | **Redirected** | The original of a [Redirect](https://docs.posternmail.app/rules/steps/#redirect) | 30 days by default ("Kept until 12 Jan") |
| Deleted for good | **Deleted for good** | [Delete](https://docs.posternmail.app/rules/steps/#delete) with **Delete for good instead of moving to Trash** | 30 days by default |

The originals of forwards are also kept, so a forward that has not gone out yet can be put back.
They are not listed here and follow the same retention.

The retention is set under **Settings → Rules → Limits and storage → Keep removed mail for …
days** (1 to 3,650 days; hint: "Copies of redirected mail and mail deleted for good. Captured
mail stays until you delete it."). It counts from the moment the rule's action finished. The Hub
removes expired copies once an hour, but never a copy that is still needed:

- the action has not finished yet (for example a redirect waiting in the sending queue),
- the rule mail bounced and waits for you,
- the rule mail was sent less than 14 days ago, the period in which the Hub watches for bounces,
- the message is being put back right now.

> [!IMPORTANT]
> Captured mail exists only on your Hub. It is not in your mailbox, not in your apps and not at
> your provider. Back up the Hub's data directory and its master key, or you lose it with the
> Hub. See [Backups](https://docs.posternmail.app/admin/backups/).

## How copies are stored

Before a rule deletes a message at the provider, the Hub:

1. downloads the complete original message (headers, text, attachments),
2. encrypts it with AES-256-GCM using your account's data key, which is itself protected by the
   Hub's master key,
3. writes it to a file under the Hub's data directory (`blobs/custody/`), flushes it to disk,
4. reads the file back, decrypts it and compares its SHA-256 checksum with the original,
5. only then records it as saved, and only after that deletes the message at the provider.

If any of this fails, the message stays in the mailbox and the action is retried. An encrypted
copy cannot be read without the master key, so copying the data directory alone does not expose
your mail. See [Encryption](https://docs.posternmail.app/security/encryption/).

## The list

Each entry shows the subject, the kind (**Redirected** or **Deleted for good**; captured mail has
no label), **Put back** if it was restored, the sender, the mailbox, the rule, how long it is
kept and when it was taken. Use **All**, **Captured**, **Redirected** and **Deleted for good** to
filter. The page shows 50 entries at a time; **Show older** loads more.

Choose an entry to open it. The reader shows From, To, Cc, **Received**, **Mailbox**, the
attachment names and the plain text of the message. A message without a plain-text part shows
"This message has no plain text. Download the .eml file to see all of it."

## Restore to mailbox

**Restore to mailbox** imports the message back into the mailbox it came from:

- into its original folder, or the Inbox if that folder no longer exists,
- with its read, star and answered state,
- with its original received date, so it sorts where it was.

The button then says **Already put back**,
and the entry gets the **Put back** label. If a sending queue item belongs to the message, it is
closed so the message is not sent any more.

| Message | Meaning | What to do |
|---|---|---|
| This message is being put back right now. Try again in a moment. | A restore of this message is already running (for example a double click). | Wait a moment and reload. |
| The mailbox no longer exists. Download the message instead. | You removed the mailbox from Postern. | Use **Download .eml** and import the file in another mail program. |
| The mailbox did not take the message back: ... | The provider refused the import. | Read the reason. Check that the mailbox is signed in and not full, then try again. |
| It wasn't put back. ... | Another error. | Try again. |

**Undo** in the [activity log](https://docs.posternmail.app/rules/activity/) and **Restore to mailbox** in the
[sending queue](https://docs.posternmail.app/rules/sending-queue/) do the same for a single rule action.

## Download .eml

**Download .eml** saves the original message as a file. Any mail program can open it, and most
can import it into a mailbox. This works for every entry, also after it was put back.

## Delete

**Delete** removes the Hub's copy. The confirmation reads "Delete this message for good? Your
Hub's copy is removed. This can't be undone."

A copy that a queued rule mail still needs cannot be deleted: "A queued rule mail still needs
this copy. Restore it or let it send first."

## Disk space

Captured mail takes space in the Hub's data directory, about the size of the original messages.
It is kept until you delete it, so a busy **Capture** rule grows without limit. Check the size
of the data volume from time to time and delete what you no longer need. Redirected and deleted
mail shrinks back after the retention period.
