wiki:Notes/PythonSMTP

Python SMTP Servers and Clients

http://python.readthedocs.org/en/latest/library/smtpd.html - Python 3.5

https://docs.python.org/2/library/smtpd.html - Python 2.7

https://docs.python.org/2/library/smtplib.html

https://docs.python.org/2/library/poplib.html

https://docs.python.org/2/library/imaplib.html

https://docs.python.org/2/library/email-examples.html

http://en.wikibooks.org/wiki/Python_Programming/Email

SMTP Server Examples

http://pymotw.com/2/smtpd/

http://bip.weizmann.ac.il/course/python/PyMOTW/PyMOTW/docs/smtpd/index.html

http://pymotw.com/2/smtplib/index.html

https://github.com/bcoe/secure-smtpd

https://github.com/kennethreitz/inbox.py

https://github.com/matrixise/dsmtpd/blob/master/dsmtpd/_dsmtpd.py

SMTP Server Implementations

Twisted Mail

http://twistedmatrix.com/trac/wiki/TwistedMail

Twisted Mail contains high-level, efficient protocol implementations for both clients and servers of SMTP, POP3, and IMAP4. Additionally, it contains an "out of the box" combination SMTP/POP3 virtual-hosting mail server. Also included is a read/write Maildir implementation and a basic Mail Exchange calculator (depends on Twisted Names).

http://twistedmatrix.com/documents/current/mail/examples/

https://launchpad.net/txmailserver

See PythonTwisted

Bonzo

https://bonzo.readthedocs.org/en/latest/

Bonzo is a Python SMTP Server using the asynchronous network library of PythonTornado. And it’s actually a port of Python’s smtpd module.

https://pypi.python.org/pypi/bonzo

https://github.com/puentesarrin/bonzo

http://puentesarr.in/bonzo-minimalistic-python-smtp-proxy/

pymta

https://www.schwarz.eu/opensource/projects/pymta/docs/html/

pymta is a library to build a custom SMTP server in Python


From: http://www.schwarz.eu/opensource/projects/pymta/docs/html/

pytma uses multiple processes to handle more than one connection at the same time. In order to do this in a platform-independent manner, it utilizes the multiprocessing module.

The basic SMTP program flow is determined by two state machines: One for the SMTP command parsing mode (single-line commands or data) in the SMTPCommandParser and another much bigger state machine in the SMTPSession to control the correct order of commands sent by the SMTP client.

The PythonMTA is the main server component which listens on a certain port for new connections. There should be only one instance of this object. When a new connection is received, the PythonMTA spawns WorkerProcess? (if you have the multiprocessing module installed) which triggers a SMTPCommand parser that handles all the SMTP communitcation. When a message was submitted successfully, the new_message_accepted() method of your IMessageDeliverer will be called so it is in charge of actually doing something with the message.

You can instantiate a new server like that:

from pymta import PythonMTA, BlackholeDeliverer

if __name__ == '__main__':
    # SMTP server will listen on localhost/port 8025
    server = PythonMTA('localhost', 8025, BlackholeDeliverer())
    server.serve_forever()

Shicks

http://p-nand-q.com/download/shicks/index.html

http://p-nand-q.com/download/shicks/manual.html

Lamson

Getting old ... 2013 ?

http://lamsonproject.org/

https://pypi.python.org/pypi/lamson/

https://github.com/zedshaw/lamson

http://lamsonproject.org/docs/api/

Last modified 2 years ago Last modified on 02/12/2015 03:48:13 PM