[javascript] MailParser

hi
any body used mailparser https://github.com/andris9/mailparser to create an eml message ?

i couldn’t know how to attach a file and how to save the eml file to file system ( let say c:\test\msg.eml )

It is best you read the documentation. They have an example of attaching a file!

var MailParser = require("mailparser").MailParser;
var mailparser = new MailParser();
var fs = require("fs");

mailparser.on("end", function(mail_object){
    console.log("Subject:", mail_object.subject);
});

fs.createReadStream("email.eml").pipe(mailparser);

Also you should read the documentation on creating and writing to a file in nodeJs there is probably 100’s of examples if not more.

do you have any example , i searched a lot but couldn’t find one

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.