Create a gist now

Instantly share code, notes, and snippets.

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
Owner
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