> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open.cx/llms.txt
> Use this file to discover all available pages before exploring further.

# Email Flow

> How forwarded mail is matched to sessions — session tokens, new-thread vs reply logic, and outbound formatting.

Use **[Connect Email](/email/forwarding)** first if you are still setting up your address and provider rules. For diagnosing issues, see **[Troubleshooting](/email/troubleshooting)**.

<Tip>
  **Email Flow** explains how **OpenCX** matches and processes mail after go-live. Setup steps stay on [Connect Email](/email/forwarding).
</Tip>

## Path Of A Message

```mermaid theme={"dark"}
flowchart LR
  A([Customer]) --> B[Support inbox]
  B --> C[Forward rule]
  C --> D[Forwarding inbox]
  D --> E[Match To and session]
  E --> F[Send reply]
  F --> G([Customer])

  style A fill:#1a5c20,color:#fff,stroke:#267a2e
  style G fill:#1a5c20,color:#fff,stroke:#267a2e
```

<Steps>
  <Step title="Customer Sends Email">
    A customer emails your support address (e.g. `support@yourcompany.com`).
  </Step>

  <Step title="Forwarded To OpenCX">
    Your email provider automatically forwards a copy to **OpenCX**.
  </Step>

  <Step title="Matched To A Conversation">
    **OpenCX** recognizes your registered address and either continues an existing conversation or starts a new one.
  </Step>

  <Step title="AI Generates Reply">
    When <Tooltip tip="Controls which conversations the AI auto-replies to. Configure per channel under Settings." cta="Autopilot settings" href="https://platform.open.cx/settings/autopilot">**Autopilot**</Tooltip> is enabled, the AI drafts an HTML-formatted reply using your knowledge base and tools, and sends it from your registered address with your signature. When Autopilot is off or the conversation is escalated, your team replies from the [inbox](https://platform.open.cx/inbox) instead.
  </Step>
</Steps>

<Note>
  Treat the thread in your [OpenCX dashboard](https://platform.open.cx) as the **authoritative** copy. Mail clients may or may not collapse replies into one visual thread depending on the mail client.
</Note>

## New Thread Vs Reply

OpenCX uses a <Tooltip tip="A numeric reference number (e.g. [12345]) embedded in the subject or body that links a reply to an existing conversation.">session token</Tooltip> to decide whether an inbound email continues an existing conversation or starts a new one.

| Situation | What happens                                                                                                                                                                                                                   |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **New**   | No matching session token, and **To** includes your registered address → new email session; original subject is stored as the conversation title.                                                                              |
| **Reply** | Same **contact From** as the session **and** a **numeric session token** in the **subject** as `[12345]` **or** in the body as `Ref: #12345` / `Reference: Ticket #12345` (new sessions use **five-digit** tokens by default). |

## Outbound Format

Replies keep the original subject with a **Re:** prefix. A small reference number is included automatically for tracking. All outgoing emails are formatted as **HTML** with unsafe content removed before delivery.

## Good To Know

<AccordionGroup>
  <Accordion title="Multiple Addresses On One Org" icon="envelopes">
    AI replies send from the address the customer wrote to. Routing keys off **To**, so each registered address is matched independently. However, some **human** agent outbound paths may pick any **connected** channel as **From** — use one primary address if you need strict alignment for agent replies.
  </Accordion>

  <Accordion title="Quotes And Attachments" icon="quote-right">
    Previous messages in the thread are automatically separated from the new reply. Inbound attachments appear on the conversation. Outbound replies from human agents can include attachments where enabled.
  </Accordion>

  <Accordion title="Security Snapshot (Non-Exhaustive)" icon="shield-check">
    Inbound mail is received securely on your behalf. Outbound replies are sent from your verified domain. For contracts or DPA questions, use your account or legal channel—not this page.
  </Accordion>
</AccordionGroup>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Troubleshooting" icon="wrench" href="/email/troubleshooting">
    Connection failures, missing replies, and common fixes.
  </Card>

  <Card title="Human Handoff" icon="user-group" href="/handoff/introduction">
    AI to human escalation — applies to email sessions.
  </Card>

  <Card title="AI Actions" icon="bolt" href="/actions/introduction">
    Run tools and workflows from email conversations.
  </Card>

  <Card title="Autopilot And Topics" icon="sliders" href="/handoff/topics">
    Channel-level Autopilot and topic rules.
  </Card>
</CardGroup>
