Created
March 28, 2011 18:10
-
-
Save baudehlo/890945 to your computer and use it in GitHub Desktop.
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
var MailParser = require("mailparser").MailParser; | |
var util = require('util'); | |
exports.hook_queue = function (callback, connection) { | |
var plugin = this; | |
// Parse the mail first... | |
var mp = new MailParser({fix_smtp_escapes: 0}); | |
var headers; | |
var body; | |
this.loginfo("parsing mail..."); | |
mp.on('headers', function (h) { | |
plugin.loginfo(util.inspect(h)); | |
headers = h; | |
}); | |
mp.on('body', function (b) { | |
plugin.loginfo(util.inspect(b)); | |
body = b; | |
}); | |
connection.transaction.data_lines.forEach(function(l) { plugin.logprotocol(l); mp.feed(l); }); | |
mp.end(); | |
callback(CONT); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment