# Send the case file to a mailbox
Mail the finished case file as a PDF to a mailbox your team or your own system reads
Source: https://www.klarefi.com/docs/guides/case-file-mailbox

## Overview

When a person on your team completes a live case, Klarefi can mail its case
file to a mailbox you choose. Most core systems and document inboxes read
mail, so this is how the finished case reaches a system that has no API you
can connect to.

The case file is the PDF Klarefi makes each time a case is completed: every
fact with its source, the open items, the decision if your workflow ends in
one, and the list of documents. It is the same file the case package points
to as `case_file_pdf`.

## What arrives

One email per completion, to each mailbox you add:

- **Subject:** your own reference for the case when it has one
  (`external_case_id`), otherwise Klarefi's case ID, then the workflow name.
- **Body:** who completed the case and when, the decision when there is one,
  how many facts the case has and how many items are still open, the SHA-256
  of the attached PDF, and a link to the case in the dashboard.
- **Then:** the name of every document in the case, and one sentence saying
  that the source documents are not attached and stay with the case in
  Klarefi.
- **Attachment:** the case-file PDF.

The email is written in the language of the case file, English or Dutch.

The source documents themselves are not attached. They stay in Klarefi, behind
the link in the email, where access to them is checked and recorded.

Test cases are never mailed. Reopening a case and completing it again is a new
completion, so it sends a new email with the new case file.

## Set it up

1. Open **Settings → Developers** and find **Case file by email**. Only a
   workspace admin can add, pause or remove a mailbox.
2. Press **Add**, give the mailbox a name you will recognise, such as
   "Document inbox", and enter one email address. You can add up to five.
3. If the address is outside your own email domain, tick the confirmation that
   case files will be sent outside it. Klarefi records who confirmed and when.
4. Press **Send a test**. Klarefi mails a sample case file made from invented
   data, marked TEST in the subject and in the file. No real case is used. The
   outcome shows next to the mailbox.

Every change to the list is written to the audit log.

## What "accepted" means

After a send, the delivery shows **Accepted by the mail service**. That means
the service Klarefi sends through took the email. It does not prove the email
reached the inbox: a full mailbox or a spam filter on your side can still stop
it. Check that the test arrived before you rely on the mailbox.

The email goes out the same way as your other Klarefi email: through the
mailbox you connected in Klarefi if you connected one, otherwise from your own
sending domain if you set one up, otherwise from Klarefi's address.

## When a send fails

Klarefi tries again after 60 seconds, 5 minutes, 30 minutes and 2 hours, five
attempts in all. A refusal that will not change, such as an address the mail
service rejects, stops at once.

When the attempts run out, the delivery shows **Failed** with the reason in
plain words, and the dashboard raises an integration notification. Press
**Send again** on the failed delivery once you have fixed the cause.

Every attempt for one completion, including **Send again**, carries the same
`Message-ID`, so a mailbox that already has the email can recognise the copy
instead of showing a second, new-looking email.

## Route the mailbox into your own system

Point the address at whatever already reads mail for your team:

- the document inbox or mail import of your core system;
- a shared mailbox your team works from, with a rule that files the email by
  the reference in the subject;
- a mail-to-folder rule that saves the PDF where your system picks up files.

Use the reference in the subject to match the email to the right file, and the
SHA-256 in the body to check that the attached PDF is the one Klarefi made.

To follow a case in your own software as well, use [webhooks](/docs/guides/webhooks)
or read the case package from the API.
