---
title: EML_PARSE
url: https://www.tines.com/docs/formulas/functions/eml-parse/
kind: formula-function
---

*[tines.com](https://www.tines.com/llms.txt) › [Docs](https://www.tines.com/llms.txt) › [Formulas](https://www.tines.com/llm/docs/formulas.md) › [Functions](https://www.tines.com/llm/docs/formulas/functions.md)*

# EML_PARSE

*[View on tines.com](https://www.tines.com/docs/formulas/functions/eml-parse/)*

Takes text containing EML (RFC822) content and parses out information such as `to`, `from`, `subject`, `attachments`, etc.

By default the parsed email includes a single `body` field containing the HTML part if available, otherwise the text part. Set the single_body optional parameter to FALSE to replace `body` with separate `body_html` and `body_text` fields.

**Categories:** Data Parsing/Conversion

## Syntax

```
EML_PARSE(text, [single_body: TRUE])
```

## Examples

### Example 1

Input:

```json
{
  "my_action": {
    "message": "Delivered-To: john@example.com\nDate: Fri, 20 Jan 2023 00:00:37 +0000\nFrom: John Smith john@example.com\nReply-To:john@example.com\nTo: john@example.com\nMessage-ID: <message_id>\nSubject: Example email\nMime-Version: 1.0\nContent-Type: multipart/alternative;\n boundary=\"--==_mimepart_63c9d9a544871_73eb214182db\";\n charset=UTF-8\nContent-Transfer-Encoding: 7bit\n\n\n----==_mimepart_63c9d9a544871_73eb214182db\nContent-Type: text/plain;\n charset=UTF-8\nContent-Transfer-Encoding: 7bit\n\nA real email body could go here\n----==_mimepart_63c9d9a544871_73eb214182db\nContent-Type: text/html;\n charset=UTF-8\nContent-Transfer-Encoding: 7bit\n\n<!DOCTYPE html>\n<html>\n <head>\n <meta content=\"text/html; charset=UTF-8\" http-equiv=\"Content-Type\" />\n </head>\n <body>\n A real email body could go here\n </body>\n</html>\n\n----==_mimepart_63c9d9a544871_73eb214182db--"
  }
}
```

Formula:

```
EML_PARSE(my_action.message)
```

Output:

```json
{
  "attachments": [],
  "body": "<!DOCTYPE html>\n<html>\n <head>\n <meta content=\"text/html; charset=UTF-8\" http-equiv=\"Content-Type\" />\n </head>\n <body>\n A real email body could go here\n </body>\n</html>\n",
  "cc": [],
  "date": "2023-01-20T00:00:37+00:00",
  "from": "John Smith john@example.com",
  "headers": {
    "Content-Transfer-Encoding": "7bit",
    "Content-Type": "multipart/alternative; boundary=\"--==_mimepart_63c9d9a544871_73eb214182db\"; charset=UTF-8",
    "Date": "Fri, 20 Jan 2023 00:00:37 +0000",
    "Delivered-To": "john@example.com",
    "From": "John Smith john@example.com",
    "Message-ID": "<message_id>",
    "Mime-Version": "1.0",
    "Reply-To": "john@example.com",
    "Subject": "Example email",
    "To": "john@example.com"
  },
  "message_id": "message_id",
  "subject": "Example email",
  "to": [
    "john@example.com"
  ]
}
```

## Sample actions

```json
{
  "standardLibVersion": "13",
  "actionRuntimeVersion": "1",
  "agents": [
    {
      "disabled": false,
      "name": "My Action",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "message": "Delivered-To: john@example.com\nDate: Fri, 20 Jan 2023 00:00:37 +0000\nFrom: John Smith john@example.com\nReply-To:john@example.com\nTo: john@example.com\nMessage-ID: <message_id>\nSubject: Example email\nMime-Version: 1.0\nContent-Type: multipart/alternative;\n boundary=\"--==_mimepart_63c9d9a544871_73eb214182db\";\n charset=UTF-8\nContent-Transfer-Encoding: 7bit\n\n\n----==_mimepart_63c9d9a544871_73eb214182db\nContent-Type: text/plain;\n charset=UTF-8\nContent-Transfer-Encoding: 7bit\n\nA real email body could go here\n----==_mimepart_63c9d9a544871_73eb214182db\nContent-Type: text/html;\n charset=UTF-8\nContent-Transfer-Encoding: 7bit\n\n<!DOCTYPE html>\n<html>\n <head>\n <meta content=\"text/html; charset=UTF-8\" http-equiv=\"Content-Type\" />\n </head>\n <body>\n A real email body could go here\n </body>\n</html>\n\n----==_mimepart_63c9d9a544871_73eb214182db--"
        }
      },
      "position": {
        "x": -210,
        "y": 3390
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "EML_PARSE",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "eml_parse": "=EML_PARSE(my_action.message)"
        }
      },
      "position": {
        "x": -210,
        "y": 3480
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 1
    }
  ],
  "diagramNotes": []
}
```
