Skip to main content

A smtpd server impletement based on Gevent

Project description

gsmtpd
======


.. image:: https://travis-ci.org/34nm/gsmtpd.svg?branch=master

SMTP servers impletement base on Gevent

Install
----------

`pip install gsmtpd`

Usage
---------

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

.. code-block:: python

from gevent import monkey
monkey.patch_all()

Example
-----------------

.. code-block:: python

from gevent import monkey
monkey.patch_all()

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()
server.serve_forever()

Performance
---------------

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

.. note::

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



.. figure:: https://raw.githubusercontent.com/34nm/gsmtpd/master/helo_chart.png
:scale: 100%

.. figure:: https://raw.githubusercontent.com/34nm/gsmtpd/master/mail_chart.png
:scale: 100%


.. _Doc: http://gsmtpd.readthedocs.org

Project details


Download files

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

Source Distribution

gsmtpd-0.1.9.1.tar.gz (9.5 kB view details)

Uploaded Source

File details

Details for the file gsmtpd-0.1.9.1.tar.gz.

File metadata

  • Download URL: gsmtpd-0.1.9.1.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for gsmtpd-0.1.9.1.tar.gz
Algorithm Hash digest
SHA256 7fddd001d68a3033022a5a28a069e3b78b457f2d5f5ab6c4f494477b087002c5
MD5 105e2f8d09610b781ec590931c170b63
BLAKE2b-256 720414292927a8b3aa1fac96d65f225d297a0e49f9b9e75ce2f054b047812e36

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page