| 1 | \section{\module{smtpd} ---
|
|---|
| 2 | SMTP Server}
|
|---|
| 3 |
|
|---|
| 4 | \declaremodule{standard}{smtpd}
|
|---|
| 5 |
|
|---|
| 6 | \moduleauthor{Barry Warsaw}{[email protected]}
|
|---|
| 7 | \sectionauthor{Moshe Zadka}{[email protected]}
|
|---|
| 8 |
|
|---|
| 9 | \modulesynopsis{Implement a flexible SMTP server}
|
|---|
| 10 |
|
|---|
| 11 | This module offers several classes to implement SMTP servers. One is
|
|---|
| 12 | a generic do-nothing implementation, which can be overridden, while
|
|---|
| 13 | the other two offer specific mail-sending strategies.
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 | \subsection{SMTPServer Objects}
|
|---|
| 17 |
|
|---|
| 18 | \begin{classdesc}{SMTPServer}{localaddr, remoteaddr}
|
|---|
| 19 | Create a new \class{SMTPServer} object, which binds to local address
|
|---|
| 20 | \var{localaddr}. It will treat \var{remoteaddr} as an upstream SMTP
|
|---|
| 21 | relayer. It inherits from \class{asyncore.dispatcher}, and so will
|
|---|
| 22 | insert itself into \refmodule{asyncore}'s event loop on instantiation.
|
|---|
| 23 | \end{classdesc}
|
|---|
| 24 |
|
|---|
| 25 | \begin{methoddesc}[SMTPServer]{process_message}{peer, mailfrom, rcpttos, data}
|
|---|
| 26 | Raise \exception{NotImplementedError} exception. Override this in
|
|---|
| 27 | subclasses to do something useful with this message. Whatever was
|
|---|
| 28 | passed in the constructor as \var{remoteaddr} will be available as the
|
|---|
| 29 | \member{_remoteaddr} attribute. \var{peer} is the remote host's address,
|
|---|
| 30 | \var{mailfrom} is the envelope originator, \var{rcpttos} are the
|
|---|
| 31 | envelope recipients and \var{data} is a string containing the contents
|
|---|
| 32 | of the e-mail (which should be in \rfc{2822} format).
|
|---|
| 33 | \end{methoddesc}
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 | \subsection{DebuggingServer Objects}
|
|---|
| 37 |
|
|---|
| 38 | \begin{classdesc}{DebuggingServer}{localaddr, remoteaddr}
|
|---|
| 39 | Create a new debugging server. Arguments are as per
|
|---|
| 40 | \class{SMTPServer}. Messages will be discarded, and printed on
|
|---|
| 41 | stdout.
|
|---|
| 42 | \end{classdesc}
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 | \subsection{PureProxy Objects}
|
|---|
| 46 |
|
|---|
| 47 | \begin{classdesc}{PureProxy}{localaddr, remoteaddr}
|
|---|
| 48 | Create a new pure proxy server. Arguments are as per \class{SMTPServer}.
|
|---|
| 49 | Everything will be relayed to \var{remoteaddr}. Note that running
|
|---|
| 50 | this has a good chance to make you into an open relay, so please be
|
|---|
| 51 | careful.
|
|---|
| 52 | \end{classdesc}
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 | \subsection{MailmanProxy Objects}
|
|---|
| 56 |
|
|---|
| 57 | \begin{classdesc}{MailmanProxy}{localaddr, remoteaddr}
|
|---|
| 58 | Create a new pure proxy server. Arguments are as per
|
|---|
| 59 | \class{SMTPServer}. Everything will be relayed to \var{remoteaddr},
|
|---|
| 60 | unless local mailman configurations knows about an address, in which
|
|---|
| 61 | case it will be handled via mailman. Note that running this has a
|
|---|
| 62 | good chance to make you into an open relay, so please be careful.
|
|---|
| 63 | \end{classdesc}
|
|---|