Skip to content

Instantly share code, notes, and snippets.

@mattieb
Created March 1, 2013 20:58
Show Gist options
  • Save mattieb/5067736 to your computer and use it in GitHub Desktop.
Save mattieb/5067736 to your computer and use it in GitHub Desktop.
Spawns a little SMTP server that will redirect all mail relayed through it to you.
import asyncore
import smtpd
MY_ADDRESS = 'user@example.com'
class RedirectingProxy(smtpd.PureProxy):
def _deliver(self, mailfrom, rcpttos, data):
smtpd.PureProxy._deliver(self, mailfrom, [MY_ADDRESS], data)
if __name__ == '__main__':
proxy = RedirectingProxy(('localhost', 2525), ('localhost', 25))
asyncore.loop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment