smtpd (version Python SMTP proxy version 0.2)
index
/usr/local/lib/python2.3/smtpd.py

An RFC 2821 smtp proxy.
 
Usage: %(program)s [options] [localhost:localport [remotehost:remoteport]]
 
Options:
 
    --nosetuid
    -n
        This program generally tries to setuid `nobody', unless this flag is
        set.  The setuid call will fail if this program is not run as root (in
        which case, use this flag).
 
    --version
    -V
        Print the version number and exit.
 
    --class classname
    -c classname
        Use `classname' as the concrete SMTP proxy class.  Uses `SMTPProxy' by
        default.
 
    --debug
    -d
        Turn on debugging prints.
 
    --help
    -h
        Print this message and exit.
 
Version: %(__version__)s
 
If localhost is not given then `localhost' is used, and if localport is not
given then 8025 is used.  If remotehost is not given then `localhost' is used,
and if remoteport is not given, then 25 is used.

 
Modules
       
asynchat
asyncore
errno
getopt
os
socket
sys
time

 
Classes
       
Devnull
Options
asynchat.async_chat(asyncore.dispatcher)
SMTPChannel
asyncore.dispatcher
SMTPServer
DebuggingServer
PureProxy
MailmanProxy

 
class DebuggingServer(SMTPServer)
    
Method resolution order:
DebuggingServer
SMTPServer
asyncore.dispatcher

Methods defined here:
process_message(self, peer, mailfrom, rcpttos, data)
# Do something with the gathered message

Methods inherited from SMTPServer:
__init__(self, localaddr, remoteaddr)
handle_accept(self)

Methods inherited from asyncore.dispatcher:
__getattr__(self, attr)
# cheap inheritance, used to pass all other attribute
# references to the underlying socket object.
__repr__(self)
accept(self)
add_channel(self, map=None)
bind(self, addr)
close(self)
connect(self, address)
create_socket(self, family, type)
del_channel(self, map=None)
handle_close(self)
handle_connect(self)
handle_error(self)
handle_expt(self)
handle_expt_event(self)
handle_read(self)
handle_read_event(self)
handle_write(self)
handle_write_event(self)
listen(self, num)
log(self, message)
log_info(self, message, type='info')
readable(self)
recv(self, buffer_size)
send(self, data)
set_reuse_addr(self)
set_socket(self, sock, map=None)
writable(self)

Data and other attributes inherited from asyncore.dispatcher:
accepting = 0
addr = None
closing = 0
connected = 0
debug = 0

 
class Devnull
     Methods defined here:
flush(self)
write(self, msg)

 
class MailmanProxy(PureProxy)
    
Method resolution order:
MailmanProxy
PureProxy
SMTPServer
asyncore.dispatcher

Methods defined here:
process_message(self, peer, mailfrom, rcpttos, data)

Methods inherited from SMTPServer:
__init__(self, localaddr, remoteaddr)
handle_accept(self)

Methods inherited from asyncore.dispatcher:
__getattr__(self, attr)
# cheap inheritance, used to pass all other attribute
# references to the underlying socket object.
__repr__(self)
accept(self)
add_channel(self, map=None)
bind(self, addr)
close(self)
connect(self, address)
create_socket(self, family, type)
del_channel(self, map=None)
handle_close(self)
handle_connect(self)
handle_error(self)
handle_expt(self)
handle_expt_event(self)
handle_read(self)
handle_read_event(self)
handle_write(self)
handle_write_event(self)
listen(self, num)
log(self, message)
log_info(self, message, type='info')
readable(self)
recv(self, buffer_size)
send(self, data)
set_reuse_addr(self)
set_socket(self, sock, map=None)
writable(self)

Data and other attributes inherited from asyncore.dispatcher:
accepting = 0
addr = None
closing = 0
connected = 0
debug = 0

 
class Options
     Data and other attributes defined here:
classname = 'PureProxy'
setuid = 1

 
class PureProxy(SMTPServer)
    
Method resolution order:
PureProxy
SMTPServer
asyncore.dispatcher

Methods defined here:
process_message(self, peer, mailfrom, rcpttos, data)

Methods inherited from SMTPServer:
__init__(self, localaddr, remoteaddr)
handle_accept(self)

Methods inherited from asyncore.dispatcher:
__getattr__(self, attr)
# cheap inheritance, used to pass all other attribute
# references to the underlying socket object.
__repr__(self)
accept(self)
add_channel(self, map=None)
bind(self, addr)
close(self)
connect(self, address)
create_socket(self, family, type)
del_channel(self, map=None)
handle_close(self)
handle_connect(self)
handle_error(self)
handle_expt(self)
handle_expt_event(self)
handle_read(self)
handle_read_event(self)
handle_write(self)
handle_write_event(self)
listen(self, num)
log(self, message)
log_info(self, message, type='info')
readable(self)
recv(self, buffer_size)
send(self, data)
set_reuse_addr(self)
set_socket(self, sock, map=None)
writable(self)

Data and other attributes inherited from asyncore.dispatcher:
accepting = 0
addr = None
closing = 0
connected = 0
debug = 0

 
class SMTPChannel(asynchat.async_chat)
    
Method resolution order:
SMTPChannel
asynchat.async_chat
asyncore.dispatcher

Methods defined here:
__init__(self, server, conn, addr)
collect_incoming_data(self, data)
# Implementation of base class abstract method
found_terminator(self)
# Implementation of base class abstract method
push(self, msg)
# Overrides base class for convenience
smtp_DATA(self, arg)
smtp_HELO(self, arg)
# SMTP and ESMTP commands
smtp_MAIL(self, arg)
smtp_NOOP(self, arg)
smtp_QUIT(self, arg)
smtp_RCPT(self, arg)
smtp_RSET(self, arg)

Data and other attributes defined here:
COMMAND = 0
DATA = 1

Methods inherited from asynchat.async_chat:
close_when_done(self)
automatically close this channel once the outgoing queue is empty
discard_buffers(self)
get_terminator(self)
handle_close(self)
handle_read(self)
handle_write(self)
initiate_send(self)
push_with_producer(self, producer)
readable(self)
predicate for inclusion in the readable for select()
refill_buffer(self)
# refill the outgoing buffer by calling the more() method
# of the first producer in the queue
set_terminator(self, term)
Set the input delimiter.  Can be a fixed string of any length, an integer, or None
writable(self)
predicate for inclusion in the writable for select()

Data and other attributes inherited from asynchat.async_chat:
ac_in_buffer_size = 4096
ac_out_buffer_size = 4096

Methods inherited from asyncore.dispatcher:
__getattr__(self, attr)
# cheap inheritance, used to pass all other attribute
# references to the underlying socket object.
__repr__(self)
accept(self)
add_channel(self, map=None)
bind(self, addr)
close(self)
connect(self, address)
create_socket(self, family, type)
del_channel(self, map=None)
handle_accept(self)
handle_connect(self)
handle_error(self)
handle_expt(self)
handle_expt_event(self)
handle_read_event(self)
handle_write_event(self)
listen(self, num)
log(self, message)
log_info(self, message, type='info')
recv(self, buffer_size)
send(self, data)
set_reuse_addr(self)
set_socket(self, sock, map=None)

Data and other attributes inherited from asyncore.dispatcher:
accepting = 0
addr = None
closing = 0
connected = 0
debug = 0

 
class SMTPServer(asyncore.dispatcher)
     Methods defined here:
__init__(self, localaddr, remoteaddr)
handle_accept(self)
process_message(self, peer, mailfrom, rcpttos, data)
Override this abstract method to handle messages from the client.
 
peer is a tuple containing (ipaddr, port) of the client that made the
socket connection to our smtp port.
 
mailfrom is the raw address the client claims the message is coming
from.
 
rcpttos is a list of raw addresses the client wishes to deliver the
message to.
 
data is a string containing the entire full text of the message,
headers (if supplied) and all.  It has been `de-transparencied'
according to RFC 821, Section 4.5.2.  In other words, a line
containing a `.' followed by other text has had the leading dot
removed.
 
This function should return None, for a normal `250 Ok' response;
otherwise it returns the desired response string in RFC 821 format.

Methods inherited from asyncore.dispatcher:
__getattr__(self, attr)
# cheap inheritance, used to pass all other attribute
# references to the underlying socket object.
__repr__(self)
accept(self)
add_channel(self, map=None)
bind(self, addr)
close(self)
connect(self, address)
create_socket(self, family, type)
del_channel(self, map=None)
handle_close(self)
handle_connect(self)
handle_error(self)
handle_expt(self)
handle_expt_event(self)
handle_read(self)
handle_read_event(self)
handle_write(self)
handle_write_event(self)
listen(self, num)
log(self, message)
log_info(self, message, type='info')
readable(self)
recv(self, buffer_size)
send(self, data)
set_reuse_addr(self)
set_socket(self, sock, map=None)
writable(self)

Data and other attributes inherited from asyncore.dispatcher:
accepting = 0
addr = None
closing = 0
connected = 0
debug = 0

 
Functions
       
parseargs()
usage(code, msg='')

 
Data
        COMMASPACE = ', '
DEBUGSTREAM = <smtpd.Devnull instance>
EMPTYSTRING = ''
NEWLINE = '\n'
__all__ = ['SMTPServer', 'DebuggingServer', 'PureProxy', 'MailmanProxy']
__version__ = 'Python SMTP proxy version 0.2'
program = '/usr/bin/pydoc'