mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-25 14:25:02 +00:00
Email Parser Plugin
RFC 5322 email message parser for MetaBuilder workflow engine.
Plugin: email-parser
Parses RFC 5322 format email messages into structured components.
Inputs:
message(string, required) - Email message in RFC 5322 formatincludeAttachments(boolean, optional, default: true) - Whether to extract attachment metadata
Outputs:
status(string) - 'parsed' or 'error'data(object) - Contains:headers(object) - Parsed email headers (from, to, cc, bcc, subject, date, messageId, etc.)body(string) - Full message body as raw stringtextBody(string, optional) - Plain text versionhtmlBody(string, optional) - HTML versionattachments(array) - Attachment metadata with filename, mimeType, size, isInlineparseTime(number) - Timestamp of parsing
Header Fields:
from- Sender email addressto- Array of recipient addressescc- Array of CC recipientsbcc- Array of BCC recipientssubject- Email subjectdate- RFC 2822 date stringmessageId- Unique message identifierinReplyTo- Message ID being replied toreferences- Array of referenced message IDscontentType- MIME content typecontentTransferEncoding- Encoding method
Attachment Fields:
filename- Original filenamemimeType- MIME type (e.g., image/png, application/pdf)size- File size in bytescontentId- Content-ID for inline attachmentsisInline- Whether attachment is inline or regular
Usage:
{
"id": "parse-email",
"nodeType": "email-parser",
"parameters": {
"message": "From: sender@example.com\nTo: recipient@example.com\nSubject: Test\n\nHello World",
"includeAttachments": true
}
}
Output Example:
{
"status": "success",
"output": {
"status": "parsed",
"data": {
"headers": {
"from": "sender@example.com",
"to": ["recipient@example.com"],
"subject": "Test",
"date": "Wed, 23 Jan 2026 12:00:00 GMT"
},
"textBody": "Hello World",
"htmlBody": null,
"attachments": [],
"parseTime": 1705978800000
}
}
}
Features
- RFC 5322 Compliant - Parses standard email format
- Multipart Support - Handles multipart/mixed and multipart/alternative messages
- MIME Encoding - Decodes MIME-encoded headers
- Attachment Extraction - Identifies and extracts attachment metadata
- Header Normalization - Normalizes common headers (from, to, cc, bcc, etc.)
Building
npm run build
npm run type-check
Installation
Add to workflow package.json:
{
"devDependencies": {
"@metabuilder/workflow-plugin-email-parser": "workspace:*"
}
}
See Also
- IMAP Sync:
/workflow/plugins/ts/integration/email/imap-sync/ - IMAP Search:
/workflow/plugins/ts/integration/email/imap-search/ - Email Send:
/workflow/plugins/ts/integration/email-send/ - Plugin Registry:
/workflow/plugins/ts/email-plugins.ts