A simple objectMode through stream that parse rfc822
formatted emails to objects, using mailparser
import imapParsedStream from 'imap-parsed-stream'
const parse = imapParsedStream();
mailsStream
.pipe(imapParsedStream)
.pipe(concat({encoding: 'object'}, result => {
}));
[
{
"headers": {
"date": "Sat, 28 Dec 2013 07:12:01 -0800 (PST)",
"subject": "Aggiungi una foto del profilo",
"from": "\"Google+\" <noreply-bbf11161@plus.google.com>",
"to": "imaptest73@gmail.com"
},
"subject": "Aggiungi una foto del profilo",
"priority": "normal",
"from": [
{
"address": "noreply-bbf11161@plus.google.com",
"name": "Google+"
}
],
"to": [
{
"address": "imaptest73@gmail.com",
"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+\" <noreply-bbf11161@plus.google.com>",
"to": "imaptest73@gmail.com"
},
"subject": "I post più popolari della settimana su Google+",
"priority": "normal",
"from": [
{
"address": "noreply-bbf11161@plus.google.com",
"name": "Google+"
}
],
"to": [
{
"address": "imaptest73@gmail.com",
"name": ""
}
],
"date": "2013-12-03T22:05:25.000Z"
}
]