Skip to content

Instantly share code, notes, and snippets.

@mfussenegger
Created November 22, 2012 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfussenegger/4131802 to your computer and use it in GitHub Desktop.
Save mfussenegger/4131802 to your computer and use it in GitHub Desktop.
class DebuggingServer(SMTPServer):
# Do something with the gathered message
def process_message(self, peer, mailfrom, rcpttos, data):
inheaders = 1
lines = data.split('\n')
print '---------- MESSAGE FOLLOWS ----------'
for line in lines:
# headers first
if inheaders and not line:
print 'X-Peer:', peer[0]
inheaders = 0
print line
print '------------ END MESSAGE ------------'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment