aboutsummaryrefslogtreecommitdiffstats
path: root/testing/perl-mail-sendmail/fake-smtp.py
blob: 25929d9b8a60e40ba7d0393673085e465a611de5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import smtpd
import asyncore

class FakeSMTPServer(smtpd.SMTPServer):
    """A Fake smtp server"""

    def __init__(*args, **kwargs):
        smtpd.SMTPServer.__init__(*args, **kwargs)

    def process_message(*args, **kwargs):
        pass

if __name__ == "__main__":
    smtp_server = FakeSMTPServer(('127.0.0.1', 2525), None)
    try:
        asyncore.loop(timeout=1, count=30)
    except KeyboardInterrupt:
        smtp_server.close()