---
title: MSG_PARSE
url: https://www.tines.com/docs/formulas/functions/msg-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)*

# MSG_PARSE

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

Takes the contents of an .msg file (Outlook item/email) and parses out information such as `to`, `from`, `subject`, `attachments`, etc.

By default headers are truncated on newline characters. To parse full headers set the extract_multiline_headers optional parameter to TRUE.

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.

Output is consistent with `EML_PARSE`.

**Categories:** Data Parsing/Conversion

## Syntax

```
MSG_PARSE(file, [extract_multiline_headers: FALSE], [single_body: TRUE])
```

## Examples

### Example 1

Input:

```json
{
  "my_action": {
    "message": {
      "file_upload_1": {
        "contents": "BASE64 Encoded .msg file contents",
        "display_logo": true,
        "name": "Sample MSG File.msg",
        "type": "application/vnd.ms-outlook"
      }
    }
  }
}
```

Formula:

```
MSG_PARSE(BASE64_DECODE(my_action.message.file_upload_1.contents))
```

Output:

```json
{
  "attachments": [],
  "body": "<html>\n<body></body>\n</html>\n\n",
  "cc": [],
  "date": "2017-06-01T15:24:31+00:00",
  "from": "from@domain.com",
  "headers": {
    "Content-Type": "multipart/alternative; boundary=\"----_=_NextPart_001_00c81914.63ca02d3\"",
    "Date": "Thu, 01 Jun 2017 15:24:31 +0000",
    "From": "from@domain.com",
    "Message-ID": "c58b1b52f61f4789ba40339c6e993440",
    "Mime-Version": "1.0",
    "Subject": "creating an outlook message file",
    "Thread-Topic": "creating an outlook message file",
    "To": "to@domain.com",
    "X-Unsent": "1"
  },
  "message_id": "c58b1b52f61f4789ba40339c6e993440",
  "subject": "creating an outlook message file",
  "to": [
    "to@domain.com"
  ]
}
```

## Sample actions

```json
{
  "standardLibVersion": "13",
  "actionRuntimeVersion": "1",
  "agents": [
    {
      "disabled": false,
      "name": "New Page",
      "description": "",
      "options": {
        "fields": "",
        "mode": "success_page",
        "submissionMessage": "Thank you for your submission",
        "visibility": "tenant",
        "pages_background_color": "#F9F9F9",
        "page_logo": {
          "name": "nites.jpeg",
          "type": "image/jpeg",
          "contents": "iVBORw0KGgoAAAANSUhEUgAAAFQAAAAYCAYAAABk8drWAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAARCSURBVHgB7VhLctpAEB1k7LVyA/kEgRMEn8BQ5e8qcALjE1icAPsEkJW/VeATwA1QTmDlBCE7l3/kPblbTIiMJcVOeaFXBRrN9Mz0vOnu6ZExBQoUKFCgwAdByX4ZDAbuw8PDwWw2a+LVk+rAcZxgZWWl02g0QpMSl5eXXRlnvLq62kLfqcmIi4uLZqlU+lwulztJ/aGvJ/p+39nZ6cu8R3j30c/f3t7umP8MRwtXV1df7+/vb6iMmZNJVJ6enppom5ydnbVNCpAIjENZF786Fn1kMgLE1PDocRz0HyTJQKe2zNOjMbBO3o1sZgS2Ybw29KqYd0ZEKMg8AGl980zAS3BhqV0Sv0Qmsho8/iCQi5T6XED/WtJmoj7W9/b2Vgk9gXUGWM+JtoF4H/VdFEdK/HvB4UIxuZ+2A2SPlykFayLhXkJ9z/wDsJlHaTZld3fXR4ho7O3tHWudRbyrxC+Ca+L4rxFuyXlJ7c7j4yOtKcuuuXd3d+0XJvMkZPwFWpm4cV64sLTBawuGB/UYus7Pz7vUB3NOYLGxV+EsuIHrT2ydITNCn5/sxyfaKdO0x02Qo8wNY7Yt52ChmeOKraAN2ZxlyBxLZb6xFCuvxWN4UE361PGYYn1egli0KSQJxIy42VIfso959rCehplFOYYUkY0MCJvn68C5CDUJLi2ho7msExVa3Pk0QL9veJxIuZ3W0pkZIMNYR3GodSBjA3VVlsUAPK1HprCOuqoQpmHGRV3FzNfcQvZQpSx06YjcFx3fMW8E7mBK0W6egwEk+ObZKkjqIO0hR1Ih/0vfYeGhpmAwgLpUX4OkMQv7+/shCNV0i+GtBrlYX5Kn2QLjNTeCMVvby6KkZ7IhsF/E6jyTDhqDfZMBJAHzUHHGP1cOuR8mJ05PTz0zPzs2MfZM20BgLAfCXGzmEAYTWbN4YRPy3JQxNusauo1V3hF3yopg4T1TbISSB3nSKLhZgL6HLDN8oLxp3ga8vPSTfnD3MTcTzw1ypeHASI6NX88+5Jy1tTWmF1luMRw8voHIKeeZbHBTHGCJgGseW4dU7pySrm3m6w62trZa9o/kQcdrkTNwaw9c8fZVhcV+oqtb5FY0DDgSTw7TKgKT7+gkhH0jyQK6Tt4kG+7eMtmMIAasLj6ELULqtsfw8oJ1jdA+YGjgLYvvPCcoR84Yc63+UWiIxucf78HiSsuUZFvLTpgF73rzSAI3FMS0MnQJtUCSmD/KdwvdGFfyygnb5NZIBGI8ShzTpwnzUcpaWU2oh1p8ytOVmDIsxIlImOkB0w/9AGFDFhaabJhCmcNlH0zgYoGxXHKxHW451LSF86vXQPdQ6sYqy7BmhYlofs7NPpImaZumR5y3jzVvsFLI0nW6ko9WRG6oaVg0v/nA0JCwjHhx1aktw3jGA+yF8dykr2ZisRVsZLg4XpIcSGWOG+b5ilagQIECBZLxG5sJ41WbSDouAAAAAElFTkSuQmCC"
        }
      },
      "position": {
        "x": 330,
        "y": 3360
      },
      "type": "form",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": {
        "fields": [
          {
            "content": null,
            "defaultValue": null,
            "description": "",
            "maxCharacters": null,
            "multiSelect": false,
            "name": "File upload 1",
            "options": [
              "Option 1",
              "Option 2"
            ],
            "required": false,
            "type": "FILE_UPLOAD"
          },
          {
            "content": "Submit",
            "defaultValue": null,
            "description": "",
            "maxCharacters": null,
            "multiSelect": false,
            "name": "Button",
            "options": [
              "Option 1",
              "Option 2"
            ],
            "required": false,
            "type": "BUTTON"
          }
        ]
      }
    },
    {
      "disabled": false,
      "name": "My Action",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "message": "=new_page.body"
        }
      },
      "position": {
        "x": 330,
        "y": 3645
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "MSG_PARSE",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "msg_parse": "=MSG_PARSE(BASE64_DECODE(my_action.message.file_upload_1.contents))"
        }
      },
      "position": {
        "x": 330,
        "y": 3735
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 1
    },
    {
      "sourceIdentifier": 1,
      "receiverIdentifier": 2
    }
  ],
  "diagramNotes": []
}
```
