/Doc/library/smtpd.rst

http://unladen-swallow.googlecode.com/ · ReStructuredText · 73 lines · 43 code · 30 blank · 0 comment · 0 complexity · 983661ba3cece78ed34f8a2451473054 MD5 · raw file

  1. :mod:`smtpd` --- SMTP Server
  2. ============================
  3. .. module:: smtpd
  4. :synopsis: A SMTP server implementation in Python.
  5. .. moduleauthor:: Barry Warsaw <barry@zope.com>
  6. .. sectionauthor:: Moshe Zadka <moshez@moshez.org>
  7. This module offers several classes to implement SMTP servers. One is a generic
  8. do-nothing implementation, which can be overridden, while the other two offer
  9. specific mail-sending strategies.
  10. SMTPServer Objects
  11. ------------------
  12. .. class:: SMTPServer(localaddr, remoteaddr)
  13. Create a new :class:`SMTPServer` object, which binds to local address
  14. *localaddr*. It will treat *remoteaddr* as an upstream SMTP relayer. It
  15. inherits from :class:`asyncore.dispatcher`, and so will insert itself into
  16. :mod:`asyncore`'s event loop on instantiation.
  17. .. method:: process_message(peer, mailfrom, rcpttos, data)
  18. Raise :exc:`NotImplementedError` exception. Override this in subclasses to
  19. do something useful with this message. Whatever was passed in the
  20. constructor as *remoteaddr* will be available as the :attr:`_remoteaddr`
  21. attribute. *peer* is the remote host's address, *mailfrom* is the envelope
  22. originator, *rcpttos* are the envelope recipients and *data* is a string
  23. containing the contents of the e-mail (which should be in :rfc:`2822`
  24. format).
  25. DebuggingServer Objects
  26. -----------------------
  27. .. class:: DebuggingServer(localaddr, remoteaddr)
  28. Create a new debugging server. Arguments are as per :class:`SMTPServer`.
  29. Messages will be discarded, and printed on stdout.
  30. PureProxy Objects
  31. -----------------
  32. .. class:: PureProxy(localaddr, remoteaddr)
  33. Create a new pure proxy server. Arguments are as per :class:`SMTPServer`.
  34. Everything will be relayed to *remoteaddr*. Note that running this has a good
  35. chance to make you into an open relay, so please be careful.
  36. MailmanProxy Objects
  37. --------------------
  38. .. class:: MailmanProxy(localaddr, remoteaddr)
  39. Create a new pure proxy server. Arguments are as per :class:`SMTPServer`.
  40. Everything will be relayed to *remoteaddr*, unless local mailman configurations
  41. knows about an address, in which case it will be handled via mailman. Note that
  42. running this has a good chance to make you into an open relay, so please be
  43. careful.