NodeJS email proxy

I am trying to proxy emails via NodeJS in order to do very custom processing on outgoing emails on our test server.

This is what I have:

var net = require('net');

var server = net.createServer({allowHalfOpen: true}, function(socket) {
    console.log('New connection established.');
    socket.setEncoding('utf8');

    socket.on('data', function(data) {
        console.log(data);
    });

    socket.on('end', function() {
        console.log('Connection closing.');
    });

    socket.resume();
});

server.listen(25);

It does not yet process the emails, because it simply doesn't even work. I get the connection established message in console every time I send an email, but the data event never gets fired. I'm not sure if it's that the data already came before I bound the event listener, or whether I'm supposed to talk to the client first (HELO?).

I'm trying to access the email contents, basically.