Last active
March 8, 2016 11:25
-
-
Save veer66/c110f09504f9ee826cd5 to your computer and use it in GitHub Desktop.
โปรแกรมสำหรับ แกะ e-mail ครับ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ลง mail parser ก่อน npm install mailparser | |
// ตัวอย่างการใช้ cat ~/trec07p/data/inmail.1 | node parse_mail.js > inmail.1.json | |
var MailParser = require("mailparser").MailParser; | |
var mailparser = new MailParser(); | |
var fs = require('fs'); | |
var email = fs.readFileSync('/dev/stdin').toString(); | |
mailparser.on("end", function(mail_object){ | |
console.log(JSON.stringify(mail_object)); | |
}); | |
mailparser.write(email); | |
mailparser.end(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment