blob: 276751634d1abaff6c3565580f72c9bcbf1440f9 [file] [log] [blame]
Georg Brandl116aa622007-08-15 14:28:22 +00001: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
13This module offers several classes to implement SMTP servers. One is a generic
14do-nothing implementation, which can be overridden, while the other two offer
15specific mail-sending strategies.
16
17
18SMTPServer 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
Benjamin Petersone41251e2008-04-25 01:59:09 +000030 .. method:: process_message(peer, mailfrom, rcpttos, data)
Georg Brandl116aa622007-08-15 14:28:22 +000031
Benjamin Petersone41251e2008-04-25 01:59:09 +000032 Raise :exc:`NotImplementedError` exception. Override this in subclasses to
33 do something useful with this message. Whatever was passed in the
34 constructor as *remoteaddr* will be available as the :attr:`_remoteaddr`
35 attribute. *peer* is the remote host's address, *mailfrom* is the envelope
36 originator, *rcpttos* are the envelope recipients and *data* is a string
37 containing the contents of the e-mail (which should be in :rfc:`2822`
38 format).
Georg Brandl116aa622007-08-15 14:28:22 +000039
40
41DebuggingServer Objects
42-----------------------
43
44
45.. class:: DebuggingServer(localaddr, remoteaddr)
46
47 Create a new debugging server. Arguments are as per :class:`SMTPServer`.
48 Messages will be discarded, and printed on stdout.
49
50
51PureProxy Objects
52-----------------
53
54
55.. class:: PureProxy(localaddr, remoteaddr)
56
57 Create a new pure proxy server. Arguments are as per :class:`SMTPServer`.
58 Everything will be relayed to *remoteaddr*. Note that running this has a good
59 chance to make you into an open relay, so please be careful.
60
61
62MailmanProxy Objects
63--------------------
64
65
66.. class:: MailmanProxy(localaddr, remoteaddr)
67
68 Create a new pure proxy server. Arguments are as per :class:`SMTPServer`.
69 Everything will be relayed to *remoteaddr*, unless local mailman configurations
70 knows about an address, in which case it will be handled via mailman. Note that
71 running this has a good chance to make you into an open relay, so please be
72 careful.
73