app.get('/:id/tracker.png', function(request, response, next) { var emailId = request.param.id; var buf = new Buffer([ 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0x80, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02, 0x02, 0x44, 0x01, 0x00, 0x3b ]); response.set('Content-Type', 'image/png'); response.end(buf, 'binary'); db.findOne({ id: emailId }, function(error, email) { if(error) return next(error); app.emit('event:opened', email); }); }); app.on('event:opened', function(email) { console.log('Email was opened'); console.log(email.to); console.log(email.subject); });
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter