# Store the original email (.eml) in your own bucket

> Keep every received message byte for byte as an .eml file in your own S3 bucket, and decide whether stored files outlive the retention period.

Source: https://emailconnect.eu/help/store-original-emails/

EmailConnect turns each email into a JSON payload for your webhook. Some workflows also need the message exactly as it arrived: a law firm archiving correspondence, an audit trail that must show the original headers, or a pipeline that wants to re-parse a message later. For those, an alias can store the original email as an `.eml` file in a storage bucket you own.

## Store the original email

**Available on:** Business and Platform plans, for aliases on your own domains.

Turn on **Store the original email (.eml)** in the alias settings. Every message the alias receives is then saved exactly as it arrived (headers, body and attachments, byte for byte) as an `.eml` file. You can open it in any mail client, and a DKIM signature still verifies against it.

### Where the files go

- **Your own storage connection only.** The alias uses the connection chosen under **Store originals in**, or your default connection. EmailConnect's platform storage never holds originals, and under [Data Residency Mode](https://emailconnect.eu/help/data-residency-mode/) there is no platform fallback either.
- **The path in the bucket** is `<folder>/eml/<yyyy>/<mm>/<dd>/<message-id>__<email id>.eml`. The folder is the alias's S3 folder; without one, files start at `eml/` in the root of your bucket. The email id at the end keeps two messages with the same Message-ID apart.
- **System-domain aliases** (`...@user.emailconnect.eu`) do not have this option.

Add a storage connection under **Settings → Storage**. Any S3-compatible bucket works (AWS, Scaleway, Hetzner, MinIO and others).

### The rawEmail block in the payload

Every webhook payload for the alias gets a `rawEmail` block:

```json
"rawEmail": {
  "status": "stored",
  "bucket": "your-bucket",
  "s3Key": "eml/2026/11/16/abc123@example.com__em_9f8e7d.eml",
  "size": 6257,
  "sha256": "7721ae1a8f82…"
}
```

| Status | Meaning |
|---|---|
| `stored` | The file is in your bucket. `sha256` is the hash of its bytes, so you can check the file you download. |
| `failed` | Storing did not work this time (for example, the bucket refused the write). The email itself is still delivered. |
| `skipped-no-own-storage` | The alias has no storage connection of your own to write to. |
| `skipped-residency` | Data Residency Mode is on and no storage connection of your own is available. |

The block is absent when the option is off or your plan does not include it. See the [webhook payload reference](https://emailconnect.eu/help/webhook-payload-reference/).

### Plan changes and deleting connections

- If your plan stops including the option, it stays on but nothing is stored until you upgrade or switch it off. Switching it off is always possible.
- You cannot delete a storage connection while an alias stores originals on it, and you cannot delete your default connection while an alias without a connection of its own stores originals through it. Switch the option off or choose another connection on the alias first.

## Keep files after retention

Stored originals and attachments follow your email's [retention period](https://emailconnect.eu/help/data-retention/): when the email is deleted, its files in your bucket are deleted too. A storage connection of your own can keep them instead.

In **Settings → Storage**, each of your own connections has two switches under **Keep after retention**:

- **Keep attachments after retention**
- **Keep original emails after retention** (Business and Platform)

With a switch on, the files stay in your bucket when the email's retention ends. The email itself is still deleted.

### Kept files are yours

- **EmailConnect no longer tracks or deletes them**, and switching the option off later does not bring them back under our control.
- **To expire them yourself**, add an S3 lifecycle rule on the `eml/` folder (or `<folder>/eml/` for an alias with its own folder).

### What still deletes files

- **Deleting an email through the API** removes its original and the attachments EmailConnect still tracks, even with keep on.
- **Deleting your account** removes the originals EmailConnect still tracks.
- **Deleting a domain or downgrading** counts as retention clean-up, so kept files stay.

### Deleting the connection

- **Kept originals stay in the bucket**, and EmailConnect can no longer erase them afterwards.
- **Keeping attachments ends with the connection**: attachments are then deleted together with their emails.

### Plans

Switching a keep option on needs the plan; switching it off is always possible. If your plan no longer includes it, a switch that is already on keeps working until you switch it off. Keep is not available on EmailConnect's platform storage.
