# Email threads

> Threads synced from users' connected mailboxes, and how they link to records.

When users connect their Gmail / Google Workspace, Microsoft 365, or company mail (IMAP/SMTP) accounts, their emails sync to the CRM. Messages on the same subject are grouped into a **thread** (`thread`). A thread links to a company and, optionally, to a project, and appears in the Emails section on the cards of the related records.

## Linking rules

1. If the other party's email address matches a person's, the thread links to that person's company. If it doesn't, the company is found from the domain, or (depending on the organization's rules) a prospect company and person are created automatically.
2. The project is chosen from these sources, in order: the reply chain, the first message sent from the CRM, the company's only open project, a quote / project number in the subject, and the company's most recent project (as a suggestion). The reason for the choice is in the `opp_how` field.
3. Users can move a thread to another project, link it to a visit / trial / task / quote / ticket / contract, or dismiss the suggestion ([Link a thread to a record](/rest-api/email/threads-action)).

Noise such as newsletters, notifications, and auto-replies isn't synced. On the **Email account** (*E-posta hesabı*) page, admins can use the **Organization email rules** (*Kuruluş e-posta kuralları*) card to skip certain domains entirely or to stop creating people from them.

## Privacy

The mailbox owner chooses how it's shared: **full** (*tam*), where the team sees message content, or **headers only** (*yalnız üst bilgi*), where the team sees subjects and people but the content is hidden. Users who aren't allowed to see the content receive messages with `body: null`, `hidden: true`. This rule also applies to the API and MCP.

## Thread fields

| Field | Type | Description |
|---|---|---|
| `id` | integer | Thread ID. |
| `subject` | string | Subject. |
| `customer_id`, `customer` | integer, string | Linked company. |
| `opp_id`, `opp`, `opp_how` | integer, string | Linked project and why it was chosen (`chain`, `compose`, `single`, `number`, `recent`, `manual`…). |
| `suggested` | boolean | The project is only a suggestion (`recent`). |
| `n`, `last_at`, `last_dir` | integer, datetime, string | Message count, time of the last message, and its direction (`in` incoming, `out` outgoing). |
| `waiting` | boolean | The last message was incoming — awaiting a reply. |
| `peer` | string | The last external person in the thread. |

The single-record endpoint also returns `messages`, `links`, `companies`, `suggestions`, `linkables`, `may_edit`, and a ready-made `reply` for responding (recipient, `Re:` subject, `in_reply_to`).

## Sending

The [Send an email](/rest-api/email/send) endpoint sends the message from the user's **own account**; the message also lands in the Sent folder and is linked to the thread. Bulk sending and email sequences are available only in the web interface (Email Automation module).