Skip to main content

A smtpd server impletement based on Gevent

Project description

SMTP servers impletement base on Gevent


pip install gsmtpd


Basically gsmtpd is ported from Python standard lib smtpd, you can it check from Doc

however there is only one difference, you should add monkey patch of gevent

from gevent import monkey


from gevent import monkey
from gsmtpd.server import SMTPServer

class DebuggingServer(SMTPServer):
    # Do something with the gathered message
    def process_message(self, peer, mailfrom, rcpttos, data):
        inheaders = 1
        lines = data.split('\n')
        print '---------- MESSAGE FOLLOWS ----------'
        for line in lines:
            # headers first
            if inheaders and not line:
                print 'X-Peer:', peer[0]
                inheaders = 0
            print line
        print '------------ END MESSAGE ------------'

if __name__ == "__main__":

    server = DebuggingServer()


The charts below shows gsmtpd vs asyncore based smtpd in Python standrary lib.


Response per second = 0 means the program is crashed or refuse to connect

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for gsmtpd, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size gsmtpd-0.2.tar.gz (9.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page