Emal icon

Emal

Manipulate EML

Overview

This n8n node processes EML (email message) files. It extracts email attachments from the provided EML data, supporting both plain text and base64-encoded inputs. This node is useful in workflows where you need to parse incoming emails, extract their attachments, and process or store them further. For example, you could use it to automatically save invoice PDFs sent via email or to analyze attachments for security purposes.

Properties

Name Type Meaning
EML Input String Raw EML data representing the full email content, including headers and body.
Base64 Input Boolean Whether the EML input is base64-encoded (true) or plain text (false).

Output

The node outputs a JSON array where each item represents an attachment extracted from the EML file. Each output object contains metadata about the attachment (such as filename, content type, etc.) and the attachment content itself. The exact structure depends on the eml-parser library's output, but typically includes:

[
  {
    "filename": "example.pdf",
    "contentType": "application/pdf",
    "content": "<base64 or raw content>",
    // ...other metadata fields
  }
]

If the EML contains multiple attachments, each will be a separate item in the output array.

Dependencies

  • External Library: Uses the eml-parser npm package to parse EML files.
  • No credentials are required.
  • No special n8n configuration or environment variables are needed.

Troubleshooting

  • Invalid Base64 Input: If "Base64 Input" is set to true but the EML data is not valid base64, parsing will fail. Ensure your input matches the selected encoding.
  • Malformed EML Data: If the EML input is incomplete or corrupted, the parser may throw errors or return no attachments.
  • Large Attachments: Very large attachments may cause memory issues depending on your n8n instance resources.

Common error messages:

  • "Error: Invalid character in base64": Check that your input is correctly base64-encoded.
  • "Error: Unable to parse EML": Ensure the EML data is complete and well-formed.

Links and References

Discussion