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 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | This module offers several classes to implement SMTP servers. One is a generic |
| 14 | do-nothing implementation, which can be overridden, while the other two offer |
| 15 | specific mail-sending strategies. |
| 16 | |
| 17 | |
| 18 | SMTPServer Objects |
| 19 | ------------------ |
| 20 | |
| 21 | |
| 22 | .. class:: SMTPServer(localaddr, remoteaddr) |
| 23 | |
| 24 | Create a new :class:`SMTPServer` object, which binds to local address |
| 25 | *localaddr*. It will treat *remoteaddr* as an upstream SMTP relayer. It |
| 26 | inherits from :class:`asyncore.dispatcher`, and so will insert itself into |
| 27 | :mod:`asyncore`'s event loop on instantiation. |
| 28 | |
| 29 | |
| 30 | .. method:: SMTPServer.process_message(peer, mailfrom, rcpttos, data) |
| 31 | |
| 32 | Raise :exc:`NotImplementedError` exception. Override this in subclasses to do |
| 33 | something useful with this message. Whatever was passed in the constructor as |
| 34 | *remoteaddr* will be available as the :attr:`_remoteaddr` attribute. *peer* is |
| 35 | the remote host's address, *mailfrom* is the envelope originator, *rcpttos* are |
| 36 | the envelope recipients and *data* is a string containing the contents of the |
| 37 | e-mail (which should be in :rfc:`2822` format). |
| 38 | |
| 39 | |
| 40 | DebuggingServer Objects |
| 41 | ----------------------- |
| 42 | |
| 43 | |
| 44 | .. class:: DebuggingServer(localaddr, remoteaddr) |
| 45 | |
| 46 | Create a new debugging server. Arguments are as per :class:`SMTPServer`. |
| 47 | Messages will be discarded, and printed on stdout. |
| 48 | |
| 49 | |
| 50 | PureProxy Objects |
| 51 | ----------------- |
| 52 | |
| 53 | |
| 54 | .. class:: PureProxy(localaddr, remoteaddr) |
| 55 | |
| 56 | Create a new pure proxy server. Arguments are as per :class:`SMTPServer`. |
| 57 | Everything will be relayed to *remoteaddr*. Note that running this has a good |
| 58 | chance to make you into an open relay, so please be careful. |
| 59 | |
| 60 | |
| 61 | MailmanProxy Objects |
| 62 | -------------------- |
| 63 | |
| 64 | |
| 65 | .. class:: MailmanProxy(localaddr, remoteaddr) |
| 66 | |
| 67 | Create a new pure proxy server. Arguments are as per :class:`SMTPServer`. |
| 68 | Everything will be relayed to *remoteaddr*, unless local mailman configurations |
| 69 | knows about an address, in which case it will be handled via mailman. Note that |
| 70 | running this has a good chance to make you into an open relay, so please be |
| 71 | careful. |
| 72 | |