| Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 1 | :mod:`smtpd` --- SMTP Server | 
 | 2 | ============================ | 
 | 3 |  | 
 | 4 | .. module:: smtpd | 
 | 5 |    :synopsis: A SMTP server implementation in Python. | 
 | 6 |  | 
 | 7 | .. moduleauthor:: Barry Warsaw <barry@zope.com> | 
 | 8 | .. sectionauthor:: Moshe Zadka <moshez@moshez.org> | 
 | 9 |  | 
| Éric Araujo | 29a0b57 | 2011-08-19 02:14:03 +0200 | [diff] [blame] | 10 | **Source code:** :source:`Lib/smtpd.py` | 
| Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 11 |  | 
| Éric Araujo | 29a0b57 | 2011-08-19 02:14:03 +0200 | [diff] [blame] | 12 | -------------- | 
| Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 13 |  | 
 | 14 | This module offers several classes to implement SMTP servers.  One is a generic | 
 | 15 | do-nothing implementation, which can be overridden, while the other two offer | 
 | 16 | specific mail-sending strategies. | 
 | 17 |  | 
 | 18 |  | 
 | 19 | SMTPServer Objects | 
 | 20 | ------------------ | 
 | 21 |  | 
 | 22 |  | 
 | 23 | .. class:: SMTPServer(localaddr, remoteaddr) | 
 | 24 |  | 
 | 25 |    Create a new :class:`SMTPServer` object, which binds to local address | 
 | 26 |    *localaddr*.  It will treat *remoteaddr* as an upstream SMTP relayer.  It | 
 | 27 |    inherits from :class:`asyncore.dispatcher`, and so will insert itself into | 
 | 28 |    :mod:`asyncore`'s event loop on instantiation. | 
 | 29 |  | 
 | 30 |  | 
| Benjamin Peterson | c7b0592 | 2008-04-25 01:29:10 +0000 | [diff] [blame] | 31 |    .. method:: process_message(peer, mailfrom, rcpttos, data) | 
| Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 32 |  | 
| Benjamin Peterson | c7b0592 | 2008-04-25 01:29:10 +0000 | [diff] [blame] | 33 |       Raise :exc:`NotImplementedError` exception. Override this in subclasses to | 
 | 34 |       do something useful with this message. Whatever was passed in the | 
 | 35 |       constructor as *remoteaddr* will be available as the :attr:`_remoteaddr` | 
 | 36 |       attribute. *peer* is the remote host's address, *mailfrom* is the envelope | 
 | 37 |       originator, *rcpttos* are the envelope recipients and *data* is a string | 
 | 38 |       containing the contents of the e-mail (which should be in :rfc:`2822` | 
 | 39 |       format). | 
| Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 40 |  | 
 | 41 |  | 
 | 42 | DebuggingServer Objects | 
 | 43 | ----------------------- | 
 | 44 |  | 
 | 45 |  | 
 | 46 | .. class:: DebuggingServer(localaddr, remoteaddr) | 
 | 47 |  | 
 | 48 |    Create a new debugging server.  Arguments are as per :class:`SMTPServer`. | 
 | 49 |    Messages will be discarded, and printed on stdout. | 
 | 50 |  | 
 | 51 |  | 
 | 52 | PureProxy Objects | 
 | 53 | ----------------- | 
 | 54 |  | 
 | 55 |  | 
 | 56 | .. class:: PureProxy(localaddr, remoteaddr) | 
 | 57 |  | 
 | 58 |    Create a new pure proxy server. Arguments are as per :class:`SMTPServer`. | 
 | 59 |    Everything will be relayed to *remoteaddr*.  Note that running this has a good | 
 | 60 |    chance to make you into an open relay, so please be careful. | 
 | 61 |  | 
 | 62 |  | 
 | 63 | MailmanProxy Objects | 
 | 64 | -------------------- | 
 | 65 |  | 
 | 66 |  | 
 | 67 | .. class:: MailmanProxy(localaddr, remoteaddr) | 
 | 68 |  | 
 | 69 |    Create a new pure proxy server. Arguments are as per :class:`SMTPServer`. | 
 | 70 |    Everything will be relayed to *remoteaddr*, unless local mailman configurations | 
 | 71 |    knows about an address, in which case it will be handled via mailman.  Note that | 
 | 72 |    running this has a good chance to make you into an open relay, so please be | 
 | 73 |    careful. | 
 | 74 |  |