# Mail handling

URL: /workflows/processes/mail-handling · Id: `process:mail-handling`

> Mail handling reads every scanned piece of mail at the Startup’s address, routes legal mail within the hour, deposits checks and forwards the rest.

Mail handling reads every scanned piece of mail at the [Startup](/business/nouns/startup)’s address, routes legal mail within the hour, deposits checks and forwards the rest.

## Outcome
| Part | This Process |
| --- | --- |
| Outcome | Each piece of mail is read the day it arrives: legal mail reaches the Legal Lead within the hour, checks are deposited, and the rest is forwarded or shredded. |
| Reads | [File](/business/nouns/file) |
| Leaves | [Task](/business/nouns/task), [Transaction](/business/nouns/transaction), [Message](/business/nouns/message), [Bill](/business/nouns/bill) |
| On time | Within 1 day (business hours); the clock never stops. Late Actions go to the [Legal Lead](/agents/legal/legal-lead). |
| Runs in | Each Startup |

## Accountable
[Operations Lead](/agents/operations/operations-lead), [Operations Team](/agents/operations).

Responsible: [Operations Lead](/agents/operations/operations-lead).

Consulted: [Legal Lead](/agents/legal/legal-lead), [Treasurer](/agents/finance/treasurer).

Informed: [Founder](/agents/founding/founder).

## Workflows
| Workflow | Runs | Team |
| --- | --- | --- |
| [Sort mail](/workflows/processes/mail-handling/sort-mail) | on `File.created` where `source = 'mail'` | [Operations Team](/agents/operations) |

## Who does each step

| Workflow | Step | Role | Calls | Approval |
| --- | --- | --- | --- | --- |
| [Sort mail](/workflows/processes/mail-handling/sort-mail) | 1. Read the scan and sort it: legal, check, bill or other. | [Operations Lead](/agents/operations/operations-lead) | [File.get](/business/nouns/file/get) | None |
| [Sort mail](/workflows/processes/mail-handling/sort-mail) | 2. Route legal process and state notices to the Legal Lead within the hour. | [Operations Lead](/agents/operations/operations-lead) | [Task.assign](/business/nouns/task/assign) | None |
| [Sort mail](/workflows/processes/mail-handling/sort-mail) | 3. Deposit each check and attach its scan to the Transaction. | [Treasurer](/agents/finance/treasurer) | [Transaction.attach](/business/nouns/transaction/attach) | None |
| [Sort mail](/workflows/processes/mail-handling/sort-mail) | 4. Record each paper bill as a Bill for payables. | [Operations Lead](/agents/operations/operations-lead) | [Bill.create](/business/nouns/bill/create) | None |
| [Sort mail](/workflows/processes/mail-handling/sort-mail) | 5. Forward personal mail and shred junk. | [Operations Lead](/agents/operations/operations-lead) | [Message.create](/business/nouns/message/create) | None |

## Events
| Direction | When | What happens |
| --- | --- | --- |
| In | On `File.created` where `source = 'mail'` | Starts [Sort mail](/workflows/processes/mail-handling/sort-mail) |
| Out | [`Task.assigned`](/business/events/Task.assigned) | Raised by step 2 of [Sort mail](/workflows/processes/mail-handling/sort-mail) |
| Out | [`Transaction.attached`](/business/events/Transaction.attached) | Raised by step 3 of [Sort mail](/workflows/processes/mail-handling/sort-mail) |
| Out | `Bill.created` | Raised by step 4 of [Sort mail](/workflows/processes/mail-handling/sort-mail) |
| Out | `Message.created` | Raised by step 5 of [Sort mail](/workflows/processes/mail-handling/sort-mail) |

## Plays
No Play names this Process.

## Controls
No Control names this Process or a Workflow of it.

## Settings
| Setting | Type | Default | Say | Set with |
| --- | --- | --- | --- | --- |
| `mail.forwardTo` | `string` | `founder` | Forward personal mail to me | [Setting.update](/business/nouns/setting/update) |

## Failure
A failed step retries; when retries run out, the Action goes to the [Legal Lead](/agents/legal/legal-lead).

| Step | On failure |
| --- | --- |
| [Sort mail](/workflows/processes/mail-handling/sort-mail) 2. Route legal process and state notices to the Legal Lead within the hour. | Times out after 1 hour. Goes to the [Legal Lead](/agents/legal/legal-lead). |

## Loop
No loop: the path is never randomized, because it serves [Legal process](/systems/legal-and-corporate/floor/legal-process).

## Code

**Ask**

```text
Turn on mail handling
```

**API**

```bash
curl -X POST https://api.sb/leaseline.app/processes/process_1/enable \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

**SDK**

```ts
import { $ } from 'startup-builder'

await $.Process.enable({ process: 'process_1' })
```

**CLI**

```bash
npx startup-builder do Process.enable --json '{"process":"process_1"}'
```

**MCP**

```json
{
  "name": "do",
  "arguments": {
    "code": "return await $.Process.enable({ process: 'process_1' })"
  }
}
```

## Enable
On by default for every Product Template. [Process.pause](/business/nouns/process/pause) stops new Actions; Actions in progress finish.

**Ask**

```text
Forward personal mail to me
```

**API**

```bash
curl -X PATCH https://api.sb/leaseline.app/settings/setting_1 \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"value":"founder","key":"mail.forwardTo"}'
```

**SDK**

```ts
import { $ } from 'startup-builder'

await $.Setting.update({ id: 'setting_1', value: 'founder', key: 'mail.forwardTo' })
```

**CLI**

```bash
npx startup-builder do Setting.update --json '{"id":"setting_1","value":"founder","key":"mail.forwardTo"}'
```

**MCP**

```json
{
  "name": "do",
  "arguments": {
    "code": "return await $.Setting.update({ id: 'setting_1', value: 'founder', key: 'mail.forwardTo' })"
  }
}
```

## Example
Four pieces of mail reach a [Startup](/business/nouns/startup)’s mailing address in one day. A state notice reaches the [Legal Lead](/agents/legal/legal-lead) within the hour, and a $1,200 check is deposited. A paper invoice becomes a [Bill](/business/nouns/bill), and a credit-card offer is shredded.