> Source: https://builder.ema.ai/v2/agent-reference/email-parser
> Title: Email Parser Agent

# Email Parser Agent

The Email Parser Agent parses an inbound email — from a connected Gmail or Outlook mailbox — into structured fields (sender, subject, body, attachments, and headers) that downstream nodes can reference individually, instead of every node having to re-parse the raw message.

The Email Parser Agent belongs to the **Generation** group in the agent library. Under the hood it runs as a Custom agent (`custom_agent`) — the agent service forwards the node's inputs to the custom-action service, which executes the agent and returns its output. See [Custom Agent](/builder/v2/agent-reference/custom) for how the `custom_agent` dispatch mechanism works.

## When to use it

Use the Email Parser Agent as the first node in a workflow triggered by an inbound email, whenever downstream nodes need individual fields rather than the raw message:

-   Extract the sender, subject, and body so an [Intent Classifier Agent](/builder/v2/agent-reference/intent-classification) can route on the subject or body text.
-   Pull structured fields out of the body with a [Data Extractor Agent](/builder/v2/agent-reference/extraction) that only needs the message text, not the full envelope.
-   Surface attachment metadata to a downstream node that processes attached documents.

## Configuration

Add the agent to a workflow as a Custom agent and pin it by ID in `agent_config.type_config`:

```json
{ "custom_agent_id": "email_parser_agent" }
```

Input key

Required

Purpose

`email`

Yes

The raw inbound email payload from the connected mailbox integration (Gmail or Outlook).

## Inputs and output

**Input**

```json
{ "email": { "raw_message": "From: alice@example.com\nSubject: Order #4821 delay\n\nCan you tell me when my order will ship?" } }
```

**Output**

```json
{
  "sender": "alice@example.com",
  "subject": "Order #4821 delay",
  "body": "Can you tell me when my order will ship?",
  "attachments": []
}
```

A downstream node reads any field via `{{<node_id>.output.<field>}}` — for example `{{<node_id>.output.body}}` to feed the message text into a classifier or extractor.

## What's next

-   [Custom Agent](/builder/v2/agent-reference/custom) — how the `custom_agent` dispatch this agent runs on works.
-   [Intent Classifier Agent](/builder/v2/agent-reference/intent-classification) — route a workflow by classifying the parsed email body.
-   [Send Email](/builder/v2/agent-reference/send-email) — send a reply once the workflow has produced one.
