13. smtpd
— SMTP Server¶
This module offers several classes to implement SMTP servers. One is a generic do-nothing implementation, which can be overridden, while the other two offer specific mail-sending strategies.
13.1. SMTPServer Objects¶
-
class
smtpd.
SMTPServer
(localaddr, remoteaddr)[source]¶ Create a new
SMTPServer
object, which binds to local address localaddr. It will treat remoteaddr as an upstream SMTP relayer. It inherits fromasyncore.dispatcher
, and so will insert itself intoasyncore
‘s event loop on instantiation.-
process_message
(peer, mailfrom, rcpttos, data)[source]¶ Raise
NotImplementedError
exception. Override this in subclasses to do something useful with this message. Whatever was passed in the constructor as remoteaddr will be available as the_remoteaddr
attribute. peer is the remote host’s address, mailfrom is the envelope originator, rcpttos are the envelope recipients and data is a string containing the contents of the e-mail (which should be in RFC 2822 format).
-
13.2. DebuggingServer Objects¶
-
class
smtpd.
DebuggingServer
(localaddr, remoteaddr)[source]¶ Create a new debugging server. Arguments are as per
SMTPServer
. Messages will be discarded, and printed on stdout.
13.3. PureProxy Objects¶
-
class
smtpd.
PureProxy
(localaddr, remoteaddr)[source]¶ Create a new pure proxy server. Arguments are as per
SMTPServer
. Everything will be relayed to remoteaddr. Note that running this has a good chance to make you into an open relay, so please be careful.
13.4. MailmanProxy Objects¶
-
class
smtpd.
MailmanProxy
(localaddr, remoteaddr)[source]¶ Create a new pure proxy server. Arguments are as per
SMTPServer
. Everything will be relayed to remoteaddr, unless local mailman configurations knows about an address, in which case it will be handled via mailman. Note that running this has a good chance to make you into an open relay, so please be careful.