Skip to content

Instantly share code, notes, and snippets.

@tachang
Created August 31, 2018 08:42
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 tachang/1d1a5f1bde9624725920f7182e3c8e41 to your computer and use it in GitHub Desktop.
Save tachang/1d1a5f1bde9624725920f7182e3c8e41 to your computer and use it in GitHub Desktop.
SMTP Forwarding Script
import smtpd
import asyncore
class CustomSMTPServer(smtpd.SMTPServer, object):
def process_message(self, peer, mailfrom, rcpttos, data):
print 'Receiving message from:', peer
print 'Message addressed from:', mailfrom
print 'Message addressed to :', rcpttos
print 'Message length :', len(data)
super(CustomSMTPServer, self).process_message(peer, mailfrom, rcpttos, data)
server = CustomSMTPServer(('0.0.0.0', 8512), None)
asyncore.loop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment