Skip to content

Instantly share code, notes, and snippets.

@veer66
Last active March 8, 2016 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save veer66/c110f09504f9ee826cd5 to your computer and use it in GitHub Desktop.
Save veer66/c110f09504f9ee826cd5 to your computer and use it in GitHub Desktop.
โปรแกรมสำหรับ แกะ e-mail ครับ
// ลง 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