# EML Parser — Email to JSON (MIME) (`hipersoft/eml-parser`) Actor

Parse raw .eml / MIME emails into clean JSON — subject, sender, recipients, text & HTML bodies, headers and attachments. For inbox automation and data pipelines.

- **URL**: https://apify.com/hipersoft/eml-parser.md
- **Developed by:** [hiper soft](https://apify.com/hipersoft) (community)
- **Categories:** Developer tools, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.0015 / email parsed

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## EML Parser — Email to JSON (MIME)

**Turn raw `.eml` / MIME emails into clean, structured JSON** — subject, sender, recipients, text and HTML bodies, headers and attachments — ready for automation and data pipelines.

### What it does

- Parses raw `.eml` / MIME email into structured JSON.
- Extracts **subject, from, to, cc, date, message ID**.
- Returns both the **plain-text body** and the **HTML body**.
- Lists **attachments** (filename, content type, size) — and can save their bytes on request.
- Keeps a useful **subset of headers** for routing and threading.
- Saves each parsed email as a `.json` file and returns a link to it.

### Use cases

- **n8n / Make / Zapier** — drop parsed email fields straight into a workflow: create tickets, log leads, route messages.
- **Support & CRM** — normalize inbound mail into records without writing a parser.
- **Data pipelines** — batch-convert archived `.eml` files into JSON for search and analytics.
- **Compliance & e-discovery** — extract headers, bodies and attachment lists from stored messages.

### Input

Provide a raw email as text, and/or a list of URLs to `.eml` files.

```json
{
  "eml": "From: alice@example.com\r\nTo: bob@example.com\r\nSubject: Hello\r\n\r\nHi there",
  "emlUrls": ["https://example.com/message.eml"],
  "saveAttachments": false
}
```

| Field | Type | Description |
|---|---|---|
| `eml` | string | A raw `.eml` / MIME email pasted as text (parses a single message). |
| `emlUrls` | array | Direct URLs to `.eml` files to download and parse. |
| `saveAttachments` | boolean | Save attachment file bytes (small files only) instead of metadata alone. |

### Output

Each email becomes one JSON file plus a summary row in the dataset.

```json
{
  "subject": "Hello",
  "from": "alice@example.com",
  "date": "2026-08-22T10:00:00.000Z",
  "attachments": 0,
  "resultUrl": "https://api.apify.com/v2/key-value-stores/.../records/email-0001.json",
  "ok": true
}
```

The linked JSON file contains the full parsed message:

```json
{
  "subject": "Hello",
  "from": "alice@example.com",
  "to": "bob@example.com",
  "cc": null,
  "date": "2026-08-22T10:00:00.000Z",
  "messageId": "<abc123@example.com>",
  "textBody": "Hi there",
  "htmlBody": null,
  "headers": { "from": "alice@example.com", "subject": "Hello" },
  "attachments": [{ "filename": "invoice.pdf", "contentType": "application/pdf", "size": 20481 }]
}
```

#### Output schema

| Field | Type | Description |
|---|---|---|
| `subject` | string | Email subject line. |
| `from` | string | Sender address. |
| `date` | string | Message date (ISO 8601). |
| `attachments` | integer | Number of attachments found. |
| `resultUrl` | string | Link to the full parsed JSON file. |
| `ok` | boolean | Whether the email parsed successfully. |

### FAQ

**Can it handle attachments?** Yes — attachment metadata (filename, type, size) is always returned, and file bytes can be saved when `saveAttachments` is enabled (small files only).

**Both text and HTML bodies?** Yes — both are returned when present in the message.

**Can I automate it?** Yes — connect it through [integrations on the Apify platform](https://apify.com/integrations) and the [Apify API](https://docs.apify.com/api/v2), including n8n, Make and Zapier.

### Notes

Original clean-room implementation.

# Actor input Schema

## `emlUrls` (type: `array`):

One or more direct URLs to .eml / MIME files to download and parse. Each is fetched and turned into one JSON result.

## `eml` (type: `string`):

A raw .eml / MIME email pasted as text. Use this to parse a single message without hosting a file.

## `saveAttachments` (type: `boolean`):

When enabled, attachment file contents are saved to the key-value store (small files only; large attachments are skipped to protect memory). When disabled, only attachment metadata (filename, type, size) is returned.

## Actor input object example

```json
{
  "emlUrls": [],
  "eml": "",
  "saveAttachments": false
}
```

# Actor output Schema

## `results` (type: `string`):

The results as dataset items.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("hipersoft/eml-parser").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("hipersoft/eml-parser").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call hipersoft/eml-parser --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,hipersoft/eml-parser"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/w9unG4UKSO1LfxM13/builds/f5Hrwwgis0S6MoKeY/openapi.json
