MsgParser icon

MsgParser

Convert binary msg file to json object

Overview

The node parses binary .msg files (Microsoft Outlook email message files) and converts their contents into JSON objects. It extracts the main message data and any attachments embedded within the .msg file, converting attachments to base64 strings for easy handling downstream.

This node is useful when you need to process or analyze email messages stored as .msg files in workflows, such as extracting email metadata, body content, or attachments for further automation, archiving, or integration with other systems.

Example use cases:

  • Extracting email content and attachments from .msg files uploaded to a system.
  • Automating processing of emails saved as .msg files for CRM or ticketing systems.
  • Converting .msg files to JSON format for easier manipulation or storage.

Properties

Name Meaning
Input Binary Field The name of the input binary field containing the .msg file to be extracted (default: "data").

Output

The node outputs an array of items where each item's json property contains the parsed .msg file data as a JSON object. This includes:

  • All standard fields extracted from the .msg file (e.g., subject, sender, recipients, body).
  • An attachmentData array if attachments exist, where each element has:
    • name: The attachment's filename.
    • base64: The attachment content encoded as a base64 string.

If no binary data is found on the specified input field, the output JSON will be empty.

Binary data from the input is removed after parsing (binary property is deleted), so the output only contains JSON data.

Dependencies

  • Uses the external library @kenjiuno/msgreader to parse .msg files.
  • Requires the input binary data to be accessible via n8n's binary data helpers.
  • No additional API keys or external services are needed.

Troubleshooting

  • Common issues:
    • Specifying an incorrect input binary field name will cause the node to fail because it cannot find the .msg file data.
    • Providing non-.msg binary files will likely result in parsing errors.
  • Error messages:
    • Parsing errors from the underlying .msg parser may occur if the file is corrupted or not a valid .msg file.
    • If continueOnFail is disabled, the node will throw an error and stop execution on the first failure.
    • Enabling continueOnFail allows the workflow to continue, returning error details alongside successful results.

Links and References

Discussion