> For the complete documentation index, see [llms.txt](https://docs.cogram.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cogram.com/email/email-retention.md).

# Email retention

Choose the retention ruleset that sorts your organization's filed email into classes, set the domains that count as internal, and turn on email expiry.

A **retention ruleset** sorts each filed email into a **class**. Each class has a retention period, counted from the date the email was sent.

* Organization admins choose the ruleset and the additional internal domains.
* Cogram support decides which rulesets your organization can choose from.
* Cogram deletes an email when its retention period ends only after an organization admin turns on **Delete expired email**. Until then, the class is a label only. A [Continuous Data Export](https://docs.cogram.com/organization-administration/continuous-data-export.md) shows each email's class.
* Project owners and leads and organization admins can purge email of a class the ruleset allows before its period ends.

> Email retention is enabled per organization. Contact Cogram support to make a ruleset available to your organization.

## Before you start

* You are an organization admin or owner.
* Cogram has made at least one ruleset available to your organization. Without one, the **Email retention** section doesn't show.

## Where to find it

Open [**Organization settings > Emails**](https://app.cogram.com/dashboard/settings/admin/email#email-retention) and go to the **Email retention** section. It has five parts, top to bottom:

| Part                            | What it does                                                                               |
| ------------------------------- | ------------------------------------------------------------------------------------------ |
| **Organization domains**        | Your organization's own domains. They count as internal. You can't edit them here.         |
| **Additional internal domains** | Extra domains that count as internal, next to your organization's own domains.             |
| **Ruleset**                     | The ruleset your organization uses, or **None**. Each ruleset shows its retention periods. |
| **Emails by retention class**   | How many of your organization's filed emails are in each class.                            |
| **Delete expired email**        | Turns email expiry on or off, and shows who turned it on and when.                         |

## Set the additional internal domains first

A ruleset can treat email between people at your organization differently from email with outside parties. Your organization's own email domains always count as internal. **Organization domains** lists them. Cogram sets them from your organization's configuration: to change them, contact Cogram support.

Add other domains that should count as internal too, such as a sister company's domain. Set the additional internal domains **before** you select a ruleset. A change to the list applies only to emails classified after the change. Emails that already have a class keep it.

1. In **Additional internal domains**, type a domain, such as `partner-studio.com`, and press Enter or select **Add**.
2. Repeat for each domain. To remove a domain, select the **X** next to it.
3. Select **Save domains**.

A domain that is already in one of the two lists isn't added again. The section shows that it is already listed.

A domain covers its subdomains: `partner-studio.com` also covers `uk.partner-studio.com`.

When you save, Cogram rejects these entries and shows the reason next to each one:

* An email address, such as `ann@partner-studio.com`. Enter the domain only.
* A wildcard, such as `*.partner-studio.com`. A domain already covers its subdomains.
* A public mail provider, such as `gmail.com`. Everyone there would count as internal.
* A public suffix, such as `co.uk`. Every company under it would count as internal.

## Select a ruleset

1. Under **Ruleset**, read the description of each ruleset.
2. Select the ruleset your organization uses.
3. Select **Save ruleset**.

Cogram then classifies your organization's filed emails that don't have a class yet. While it works, the section shows **Classifying existing emails…**. The counts in **Emails by retention class** update when it finishes. New email gets its class when it is filed.

### Rulesets apply going forward

Selecting, changing, or clearing a ruleset never changes the class of an email that already has one.

* **Change to another ruleset**: emails classified before keep their class. New email gets the class of the new ruleset.
* **Select None**: new email gets no class. Emails classified before keep their class.

To reclassify emails that already have a class, contact Cogram support.

## See an email's retention

* **In the email list:** select **Columns** and turn on **Retention**. The column is hidden by default. It shows the email's class, **Short** or **Archive**, and stays empty for an email without a class.
* **In an email:** the email shows **Retention:** and its class. While **Delete expired email** is on, it also shows the date the email expires, for example **Retention: Short · expires Mar 4, 2028**.

## Turn on email expiry

With **Delete expired email** on, Cogram deletes every night, at 02:00 UTC, the emails whose retention period has ended. The period counts from the date the email was sent.

**What expiry deletes:**

* The email in Cogram and its attachments.
* The reasoning Cogram's filing stored about the email.

**What expiry keeps:**

* Records created from the email: RFIs, submittals, change orders, correspondence and documents. An RFI or submittal that holds a file from the email keeps the file.
* Emails without a class. They never expire.
* Your mailbox. Cogram never deletes email from Gmail or Outlook.

Each deleted email gets an entry in the deletion audit log, which you can read through the [Cogram API](https://docs.cogram.com/integrations/cogram-api.md).

To turn it on:

1. Select a ruleset first. **Turn on** stays unavailable without one.
2. Under **Delete expired email**, select **Turn on**.
3. Read the preview. It says how many emails from how many projects are past their retention period, and when the first run is, in your local time. Email keeps aging, so the first run can delete a few more.
4. Type `DELETE` in the box and select **Turn on and delete expired email**, or **Turn on expiry** when no email is past its period yet. The button is available only once the preview has its count.

The section then shows **On. Enabled by** *name* **on** *date*. After you turn it off, it shows who turned it off and when. The first run is at the next 02:00 UTC. If you turn expiry off before then, nothing is deleted. A large backlog can take several nights to finish.

To stop expiry, select **Turn off**, then **Turn off expiry** to confirm. Cogram deletes nothing more when a period ends. Emails deleted before can't be restored. Purge still works while expiry is off.

### Filing email that is already past its period

While expiry is on, Cogram doesn't file an email that is already past its retention period:

* Automatic filing skips it. The Outlook add-in and the Gmail extension say it is past your organization's retention period.
* Filing it by hand, or uploading an `.eml` or `.msg` file, shows the same message.

Email still inside its period files as usual. An unfiled email can be filed again until its period ends.

## Purge email early

Some classes can be purged before their period ends. The description of each ruleset says which. In the `som-email-v1` ruleset, only **Short** email can be purged.

Purge is separate from **Unfile**. Any project member can still unfile an email of any class.

**Who can purge:** project owners and project leads, and organization admins. You must also be able to see the email: a [confidential email](https://docs.cogram.com/email/confidential-email.md) can be purged only by the people in its audience.

1. In **Emails**, select one or more emails, then **Purge emails**. Or open an email, select **…**, then **Purge email**.
2. Read the confirmation, then select **Purge email** or **Purge emails** to confirm.

**Purge emails** shows only when you can purge every selected email. A purge deletes the email and its attachments and keeps the records created from it. It records an audit log entry with your user ID. It can't be undone.

## In a Continuous Data Export

If your organization uses [Continuous Data Export](https://docs.cogram.com/organization-administration/continuous-data-export.md), the state file of each email shows its retention:

* `retention_class`: the ruleset and the class, for example `som-email-v1/short` or `som-email-v1/archive`.
* `expires_at`: the date the email's retention period ends, once **Delete expired email** is on. A cleanup script can remove the email at that date. Null while it is off: a cleanup script then removes an email only after it leaves Cogram (`delete: true`).

`retention_class` is null for an email without a class, and for every email while your organization has no ruleset.

In Archive mode, when an email leaves Cogram, its state file says `delete: true` and why it left:

* `state: deleted`: Cogram deleted the email at the end of its retention period, or its project was deleted.
* `state: unfiled`: a person purged, unfiled or deleted the email, or a refile or a project merge removed it as a duplicate of a copy in another project.

A change of an email's class is written at the next export run. A change of the ruleset, and turning **Delete expired email** on or off, makes the next run a resync, which writes every state file again.

## Read the counts

**Emails by retention class** shows how many of your organization's filed emails are in each class:

| Class            | Meaning                                                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **Short**        | The ruleset gave the email its shorter retention period.                                                                  |
| **Archive**      | The ruleset gave the email its longer retention period.                                                                   |
| **Unclassified** | The email has no class: it was filed while your organization had no ruleset, or the classification hasn't reached it yet. |

The description of each ruleset gives the retention period of **Short** and **Archive** email.

## Troubleshooting

#### Email retention section is missing

The **Email retention** section doesn't show.

* **Likely cause:** No ruleset is available to your organization, or you aren't an organization admin.
* **Fix:** Ask Cogram support to make a ruleset available. Ask an organization admin to check your role.

#### Unclassified stays above zero

**Unclassified** stays above zero after you saved a ruleset.

* **Likely cause:** Classification is still running, or it stopped before it finished.
* **Fix:** Wait for **Classifying existing emails…** to disappear. If the count still doesn't drop, contact Cogram support.

#### Turn on is unavailable

**Turn on** is unavailable under **Delete expired email**.

* **Likely cause:** No ruleset is selected.
* **Fix:** Select and save a ruleset, then turn on expiry.

#### Purge emails is missing

**Purge emails** doesn't show for the selected emails.

* **Likely cause:** One of the selected emails is in a class the ruleset keeps until it expires, such as **Archive**, or you aren't an owner or lead of its project or an organization admin.
* **Fix:** Select only emails you can purge. Use **Unfile** to remove a misfiled email of any class.

#### Partner email is in Archive

An email with a partner company is in **Archive** although the partner should count as internal.

* **Likely cause:** The email was classified before you added the partner's domain to **Additional internal domains**.
* **Fix:** Contact Cogram support to reclassify your organization's emails.

## Related

* [Confidential email](https://docs.cogram.com/email/confidential-email.md)
* [Emails](https://docs.cogram.com/email/emails.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.cogram.com/email/email-retention.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
