# Run a flow through email

import { Steps } from "@astrojs/starlight/components"

An **Emailhook** trigger starts a flow when a message arrives at a unique address Studio assigns to that trigger. The
message body, subject, senders, recipients, attachments, and related metadata are available in the data picker for
later steps.

## When to use

- A mailbox, ticket system, or vendor notification should start a flow by sending email.
- Prefer [Run a flow through a webhook](../run-flow-through-webhook/) when the source can call HTTPS with a structured
  payload.
- Prefer [Run a flow from an AI··Room](../run-a-flow-from-an-ai-room/) when operators should start the flow from chat.

Before you begin, you need permission to create and deploy flows in the environment. Deploy the flow before you rely on
the email address in production. Your organization may also restrict which senders can trigger emailhooks — ask an
admin if inbound mail does not start the run.

## Guide

### Add an Emailhook trigger

An **Emailhook** exposes a copyable address. Sending mail to that address starts the deployed flow.

<ol>
<li>

**Open the flow.** Create or open the flow in the designer. On an empty canvas, choose **Add a step manually**.

</li>
<li>

**Choose Emailhook.** In the step catalog, open **Triggers**, then choose **Emailhook**.
<div class="docs-screenshot-compact">

![Add a step catalog Triggers section with Emailhook selected](./assets/add-step-catalog-triggers-section-emailhook.png)

</div>

</li>
<li>

**Rename and describe the step.** Rename the Emailhook step and fill a description.

</li>
<li>

**Copy the email address.** On the Emailhook step, open **Settings**. Copy **Email address** and use it as the
destination for messages that should start the flow.
<div class="docs-screenshot-compact">

![Emailhook Trigger Settings with copyable Email address field](./assets/emailhook-trigger-settings-copyable-email.png)

</div>

</li>
</ol>
### Restrict senders (optional)

On the Emailhook step, open **Advanced** and add **Allowed emails** when only specific addresses or domains should
start this flow. Entries must also pass the organization-level email allowlist when one is configured. An empty
organization list means no senders can trigger emailhooks until an admin adds patterns under **Organization**.

### Use email data in later steps

When a message arrives, Emailhook exposes fields such as **from**, **to**, **subject**, **text**, **html**,
**attachments**, and analysis verdicts. Later steps pick those values from the data picker.

<ol>
<li>

**Inspect a run.** After a test email, open the flow **Logs** (or the step **Logs** tab) and open the matching
execution.
<div class="docs-screenshot-compact">

![Flow Logs list with an emailhook execution available to open](./assets/flow-logs-list-emailhook-execution-available.png)

</div>

</li>
<li>

**Pick email fields.** In a later step formula field, open the data picker, choose the Emailhook step (or email
invocation data), then select the fields you need.
<div class="docs-screenshot-compact">

![Data picker showing email invocation fields from the Emailhook trigger](./assets/data-picker-showing-email-invocation-fields.png)

</div>
<div class="docs-screenshot-compact">

![Formula field with email data selected from the Emailhook trigger](./assets/formula-field-email-data-selected-emailhook.png)

</div>

</li>
</ol>
## Example

A security mailbox forwards vendor alerts to Mindflow. The flow **Triage vendor alert email** starts with Emailhook
**Receive vendor alert**. An analyst copies the **Email address** from Settings into the mailbox forward rule. A later
**Transform data** or **AI··Task** step reads **subject** and **text** from the Emailhook data picker to classify the
alert.

## Keep in mind

- Deploy the flow before production senders use the address.
- Organization email allowlists can block senders even when the Emailhook **Allowed emails** list looks correct.
- Prefer [Run a flow through a webhook](../run-flow-through-webhook/) when you need a structured JSON body and HTTP
  status control.

## Related

[Trigger your flow](../) ·
[Run a flow through a webhook](../run-flow-through-webhook/) ·
[Manage version and deployments](../../../operate/manage-version-and-deployments/)
