emailjs / emailjs-mime-parser

Parse a mime tree, no magic included.
MIT License
80 stars 22 forks source link

How can I restructure message from mimeNodes? #36

Closed kztmk closed 5 years ago

kztmk commented 6 years ago

Please tell me how can I get message to show using browser.

I got mimeNodes successfully, but I do not find how to restructure the message.

import imapClient from 'emailjs-imap-client'; import parse from 'emailjs-mime-parser';

const imapClietnt = new (host, port { auth: {user: userName, pass: password}}); imapClient.connect();

const messages = imapClient.lestMessages('INBOX', '1' ['uid', 'flags', 'body.peek[]']);

const myMimeNodes = parse(messages[0]['body[]'])

In case of multipart message, myMimeNodes like as follows.

-- myMimeNodes -- -- bodystructure: string -- -- contentType -- -- -- type: multipart -- -- -- params -- -- -- -- boundary: string -- -- childNodes: Array -- -- -- MimeNode -- -- -- -- content: Uint8Array

So how can I get readable text or html?

flotwig commented 6 years ago

The unit tests provide a good example of how to use it:

https://github.com/emailjs/emailjs-mime-parser/blob/master/src/mimeparser-unit.js