Skip to content

Instantly share code, notes, and snippets.

@yudai09
Created July 27, 2016 10:41
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 yudai09/36e9d9344eb69b0cfac05cd26ee33acf to your computer and use it in GitHub Desktop.
Save yudai09/36e9d9344eb69b0cfac05cd26ee33acf to your computer and use it in GitHub Desktop.
from smtpd import SMTPServer
import asyncore
class RejectSMTPServer(SMTPServer):
def process_message(self, peer, mailfrom, rcpttos, data):
return '500 Error'
def start_smtpd():
server = RejectSMTPServer(('127.0.0.1', 1025), None)
asyncore.loop()
if __name__ == '__main__':
start_smtpd()
@yudai09
Copy link
Author

yudai09 commented Jul 27, 2016

This script implements simple SMTP server which always reject emails.
you can run this script like below.
$ nohup python reject_smtpd.py &

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment