imap-parsed-stream
v1.0.2
Published
A simple objectMode through stream that parse rfc822 formatted emails to objects, using [mailparser](https://github.com/andris9/mailparser)
Downloads
3
Readme
imap-parsed-stream
A simple objectMode through stream that parse rfc822 formatted emails to objects, using mailparser
Installation
npm install --save imap-parsed-stream
How it works
Usage
import imapParsedStream from 'imap-parsed-stream'
const parse = imapParsedStream();
mailsStream
.pipe(imapParsedStream)
.pipe(concat({encoding: 'object'}, result => {
// result is an array of parsed mail
}));
Example object output
[
{
"headers": {
"date": "Sat, 28 Dec 2013 07:12:01 -0800 (PST)",
"subject": "Aggiungi una foto del profilo",
"from": "\"Google+\" <[email protected]>",
"to": "[email protected]"
},
"subject": "Aggiungi una foto del profilo",
"priority": "normal",
"from": [
{
"address": "[email protected]",
"name": "Google+"
}
],
"to": [
{
"address": "[email protected]",
"name": ""
}
],
"date": "2013-12-28T15:12:01.000Z"
},{
"headers": {
"date": "Tue, 03 Dec 2013 14:05:25 -0800 (PST)",
"subject": "I post più popolari della settimana su Google+",
"from": "\"Google+\" <[email protected]>",
"to": "[email protected]"
},
"subject": "I post più popolari della settimana su Google+",
"priority": "normal",
"from": [
{
"address": "[email protected]",
"name": "Google+"
}
],
"to": [
{
"address": "[email protected]",
"name": ""
}
],
"date": "2013-12-03T22:05:25.000Z"
}
]
License
The MIT License (MIT) Copyright (c) 2015 Andrea Parodi