Email Parsing
Parses raw email files into a normalized structured object with headers, body, and attachments, ready for classification or extraction pipelines.
Parses one Outlook MSG or RFC 822 EML message into headers, a plain-text body and its attachments as base64 files.
Dual-format dispatcher: extract-msg for Microsoft Outlook MSG (CFBF / OLE compound-file container) and mail-parser for standard RFC 822 / MIME EML messages. Format detection is automatic based on magic bytes, with an optional override.
Features:
- Header normalization: From, To, CC, BCC, Reply-To, Subject, Message-Id, In-Reply-To, and Received-Date decoded to canonical form (ISO-8601 for dates, arrays for address lists).
- Body handling: Returns plain-text body directly; when only an HTML part is present, converts to text while preserving paragraph and list breaks.
- Attachments: Each attachment emitted as
{ name, content_type, size, content_base64 }so it can be piped throughflow.splitto extractors (PDF, DOCX, OCR, etc.). - Inline vs attached: Distinguishes inline attachments (e.g. embedded images referenced by Content-Id) from user attachments in metadata.
- Encoding recovery: Handles MIME-encoded-word subjects (UTF-8, Latin-1, ISO-2022-JP) and quoted-printable / base64 bodies transparently.
- Malformed input: Emits port
emptywhen the email has no body or attachments, anderrorwith trace detail when the container itself is corrupt.
How it works
- Reads
content_base64andfile_pathfrom the node config, falling back to the upstream payload; fails onerrorwhen both are missing. Afile_paththat exists on the host wins overcontent_base64. - Picks the format:
formatfrom the config if set; otherwise.msg/.emlfrom the file name, then the OLE signature of the first bytes (MSG); anything else is parsed as EML. - Extracts subject, sender,
toandcclists, date and body. The plain-text body is preferred; when it is missing, the HTML body is converted to text (or kept as raw HTML if conversion yields nothing). - Each attachment becomes
{ name, content_type, size, content_base64 }; nameless attachments are calledattachment. - Routes to
emptywhen the body is empty and there are no attachments, otherwise toextracted.
In a workflow
The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.
{
"node_id": "node-parse-email",
"label": "Parse email",
"operator_slug": "ai.email.parse",
"operator_version": "1.0.0",
"config": {
"content_base64": "{{ $json.content_base64 }}",
"format": "eml",
"execution": {
"timeout_ms": 120000
}
}
}{
"ok": true,
"data": {
"format": "eml",
"subject": "Invoice 2026-10",
"from": "Billing <billing@example.com>",
"to": [
"ap@example.org"
],
"cc": [],
"received_at": "2026-11-20 14:03:11+00:00",
"body": "Please find the October invoice attached.",
"attachments": [
{
"name": "invoice-2026-10.pdf",
"content_type": "application/pdf",
"size": 48213,
"content_base64": "JVBERi0xLjcK..."
}
],
"chars": 41,
"empty": false,
"method": "email-eml",
"metadata": {
"attachments_count": 1
}
},
"port": "extracted"
}Configuration
-
formatstring Optional -
Override format detection. Leave empty to auto-detect.
Its configuration shows the shared execution settings, but this node does not apply retries (retryOnFail, maxTries) yet. continueOnFail is not applied by any node.
Behaviour in the code
What the implementation does with these keys beyond what the schema says.
-
content_base64, file_path - Not declared in the config schema, but read from the node config first and then from the upstream payload. Usually you map them from the previous node with expressions.
-
format - Read from the node config only (not from the payload). Forcing the wrong format makes the parser fail.
-
execution - Only
execution.timeout_msis read (fallback 120000 ms).retryOnFail,maxTries,waitBetweenTries,continueOnFailandalwaysOutputDataare ignored.
Output ports
extracted default The message has a body or at least one attachment.
{
"format": "eml",
"subject": "Invoice 2026-10",
"from": "Billing <billing@example.com>",
"to": [
"ap@example.org"
],
"cc": [],
"received_at": "2026-11-20 14:03:11+00:00",
"body": "Please find the October invoice attached.",
"attachments": [
{
"name": "invoice-2026-10.pdf",
"content_type": "application/pdf",
"size": 48213,
"content_base64": "JVBERi0xLjcK..."
}
],
"chars": 41,
"empty": false,
"method": "email-eml",
"metadata": {
"attachments_count": 1
}
}empty The message has neither body text nor attachments.
{
"format": "msg",
"subject": "",
"from": "",
"to": [],
"cc": [],
"received_at": "",
"body": "",
"attachments": [],
"chars": 0,
"empty": true,
"method": "email-msg",
"metadata": {
"attachments_count": 0
}
}error No input was given, the file could not be parsed or the script failed.
{
"error": "Either content_base64 or file_path is required",
"stderr": ""
}In expressions
What a later node can read from this node's output with $("Email Parsing").item.json.<path> (write your node's label instead of Email Parsing). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through extracted, from the output shown in Ports.
| Expression | Editor | Worker |
|---|---|---|
$("Email Parsing").item.json.format | ||
$("Email Parsing").item.json.subject | ||
$("Email Parsing").item.json.from | ||
$("Email Parsing").item.json.to | ||
$("Email Parsing").item.json.cc | ||
$("Email Parsing").item.json.received_at | ||
$("Email Parsing").item.json.body | ||
$("Email Parsing").item.json.attachments | ||
$("Email Parsing").item.json.chars | ||
$("Email Parsing").item.json.empty | ||
$("Email Parsing").item.json.method | ||
$("Email Parsing").item.json.metadata | ||
$("Email Parsing").item.json.metadata.attachments_count | — |
— Worker: The worker returns it but the editor does not suggest it: write it by hand. Keys inside objects can depend on your data or configuration (for example one key per label).
Errors
| Message | Port | Cause and fix |
|---|---|---|
Either content_base64 or file_path is required. | error | Neither the node config nor the upstream payload carries the file. Map content_base64 (or file_path) from the previous node. |
Either content_base64 or file_path is required | error | Raised by the script (no trailing period) when only file_path was given and the file does not exist on the host. |
<parser exception message> | error | The Python parser raised an exception (an MSG forced as EML or the reverse, or a damaged file). The message is passed through as data.error, with the script's stderr in data.stderr. |
Python timed out after <timeout_ms>ms | error | The script exceeded the node timeout. Raise execution.timeout_ms or send a smaller file. |
Python stdout exceeded MAX_STDOUT_BYTES (52428800 bytes) | error | The result (text or base64 files) is larger than the 50 MB cap. Split the input upstream. |
Python runtime not available (ENOENT) | error | The host has no Python interpreter. A failed dependency install shows PythonRunner failed: <message> instead. Both are host problems, not workflow problems. |
Input contract
-
content_base64string Optional -
file_pathstring Optional
Output contract
-
formatstring Optional -
subjectstring Optional -
fromstring Optional -
toarray<string> Optional -
ccarray<string> Optional -
received_atstring Optional -
bodystring Optional -
attachmentsarray<object> Optional -
charsnumber Optional -
emptyboolean Optional -
methodstring Optional -
metadataobject Optional
Contracts (JSON Schema)
The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.
{
"slug": "ai.email.parse",
"name": "Email Parsing",
"category": "ai",
"version": "1.0.0",
"description": "Parses raw email files into a normalized structured object with headers, body, and attachments, ready for classification or extraction pipelines.\n\n Dual-format dispatcher: `extract-msg` for Microsoft Outlook MSG (CFBF / OLE compound-file container) and `mail-parser` for standard RFC 822 / MIME EML messages. Format detection is automatic based on magic bytes, with an optional override.\n\n **Features:**\n - **Header normalization:** From, To, CC, BCC, Reply-To, Subject, Message-Id, In-Reply-To, and Received-Date decoded to canonical form (ISO-8601 for dates, arrays for address lists).\n - **Body handling:** Returns plain-text body directly; when only an HTML part is present, converts to text while preserving paragraph and list breaks.\n - **Attachments:** Each attachment emitted as `{ name, content_type, size, content_base64 }` so it can be piped through `flow.split` to extractors (PDF, DOCX, OCR, etc.).\n - **Inline vs attached:** Distinguishes inline attachments (e.g. embedded images referenced by Content-Id) from user attachments in metadata.\n - **Encoding recovery:** Handles MIME-encoded-word subjects (UTF-8, Latin-1, ISO-2022-JP) and quoted-printable / base64 bodies transparently.\n - **Malformed input:** Emits port `empty` when the email has no body or attachments, and `error` with trace detail when the container itself is corrupt.",
"capabilities": [
"email",
"msg",
"eml",
"mime",
"outlook",
"parsing"
],
"config_schema": {
"type": "object",
"properties": {
"format": {
"type": "string",
"title": "Format (optional)",
"enum": [
"msg",
"eml"
],
"description": "Override format detection. Leave empty to auto-detect."
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
}
},
"input_contract_schema": {
"type": "object",
"properties": {
"content_base64": {
"type": "string"
},
"file_path": {
"type": "string"
}
}
},
"output_contract_schema": {
"type": "object",
"properties": {
"format": {
"type": "string"
},
"subject": {
"type": "string"
},
"from": {
"type": "string"
},
"to": {
"type": "array",
"items": {
"type": "string"
}
},
"cc": {
"type": "array",
"items": {
"type": "string"
}
},
"received_at": {
"type": "string"
},
"body": {
"type": "string"
},
"attachments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"content_type": {
"type": "string"
},
"size": {
"type": "number"
},
"content_base64": {
"type": "string"
}
}
}
},
"chars": {
"type": "number"
},
"empty": {
"type": "boolean"
},
"method": {
"type": "string"
},
"metadata": {
"type": "object"
}
}
},
"ports": [
{
"port_id": "extracted",
"label": "Parsed",
"is_default": true,
"supports_condition": true
},
{
"port_id": "empty",
"label": "Empty",
"is_default": false,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"is_default": false,
"supports_condition": false
}
],
"execution_mode": "async",
"tags": [
"ai",
"email",
"msg",
"eml",
"parse"
],
"is_stateful": false,
"publisher": {
"identity": "org_sommatic_ai",
"profile": {
"name": "Sommatic AI",
"verified": true,
"url": "https://me.veripass.com/sommatic",
"logo_url": null
}
}
}{
"type": "object",
"properties": {
"format": {
"type": "string",
"title": "Format (optional)",
"enum": [
"msg",
"eml"
],
"description": "Override format detection. Leave empty to auto-detect."
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
}
}{
"type": "object",
"properties": {
"content_base64": {
"type": "string"
},
"file_path": {
"type": "string"
}
}
}{
"type": "object",
"properties": {
"format": {
"type": "string"
},
"subject": {
"type": "string"
},
"from": {
"type": "string"
},
"to": {
"type": "array",
"items": {
"type": "string"
}
},
"cc": {
"type": "array",
"items": {
"type": "string"
}
},
"received_at": {
"type": "string"
},
"body": {
"type": "string"
},
"attachments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"content_type": {
"type": "string"
},
"size": {
"type": "number"
},
"content_base64": {
"type": "string"
}
}
}
},
"chars": {
"type": "number"
},
"empty": {
"type": "boolean"
},
"method": {
"type": "string"
},
"metadata": {
"type": "object"
}
}
}[
{
"port_id": "extracted",
"label": "Parsed",
"is_default": true,
"supports_condition": true
},
{
"port_id": "empty",
"label": "Empty",
"is_default": false,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"is_default": false,
"supports_condition": false
}
]Execution
- Execution
async- Stateful
- No
- Retries (
retryOnFail) - No
- Capabilities
emailmsgemlmimeoutlookparsing- Tags
aiemailmsgemlparse
Notes and limits
- Runs a Python script in a child process. The first run on a worker host creates a virtual environment and installs the script's pinned dependencies (it can take minutes and is not counted in the node timeout); later runs reuse it.
file_pathmust point to a file on the local disk of the orchestrator host that runs the node; it is not a URL and is not fetched from storage.- The script is killed after
execution.timeout_ms; when that key is not set the code uses 120000 ms, not the schema default of 300000. - The script's JSON answer is capped at 50 MB (52428800 bytes, configurable on the host). Because files travel as base64, large inputs or outputs can hit this cap.
- For MSG,
toandccare split on;,fromis the sender string and attachmentcontent_typeis guessed from the name. For EML, addresses are formatted asName <email>andcontent_typecomes from the message. received_atis the message date as text, in the format the parser gives; it is not normalised to ISO 8601.- Pair it with
flow.splitoverattachmentsto process each attachment downstream.
Reviewed against the orchestrator code · 31e874b · 2026-11-26