Back to module index
Go to module by name
smtpd
An RFC 5321 smtp proxy with optional RFC 1870 and RFC 6531 extensions.
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 `PureProxy' by
default.
--size limit
-s limit
Restrict the total size of the incoming message to "limit" number of
bytes via the RFC 1870 SIZE extension. Defaults to 33554432 bytes.
--smtputf8
-u
Enable the SMTPUTF8 extension and behave as an RFC 6531 smtp proxy.
--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.
Classes
DebuggingServer
writable.SMTPChannel
accept(self)
add_channel(self, map=None)
bind(self, addr)
close(self)
close_when_done(self)
automatically close this channel once the outgoing queue is empty
collect_incoming_data(self, data)
connect(self, address)
create_socket(self, family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>)
del_channel(self, map=None)
discard_buffers(self)
found_terminator(self)
get_terminator(self)
handle_accept(self)
handle_accepted(self, sock, addr)
handle_close(self)
handle_connect(self)
handle_connect_event(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)
initiate_send(self)
listen(self, num)
log(self, message)
log_info(self, message, type='info')
push(self, msg)
push_with_producer(self, producer)
readable(self)
predicate for inclusion in the readable for select()
recv(self, buffer_size)
send(self, data)
set_reuse_addr(self)
set_socket(self, sock, map=None)
set_terminator(self, term)
Set the input delimiter.
Can be a fixed string of any length, an integer, or None.
smtp_DATA(self, arg)
smtp_EHLO(self, arg)
smtp_EXPN(self, arg)
smtp_HELO(self, arg)
smtp_HELP(self, arg)
smtp_MAIL(self, arg)
smtp_NOOP(self, arg)
smtp_QUIT(self, arg)
smtp_RCPT(self, arg)
smtp_RSET(self, arg)
smtp_VRFY(self, arg)
writable(self)
predicate for inclusion in the writable for select()
COMMAND = 0
DATA = 1
ac_in_buffer_size = 65536
ac_out_buffer_size = 65536
accepting = False
addr = None
closing = False
command_size_limit = 512
command_size_limits = defaultdict(<function SMTPChannel.<lambda> at 0x7f75e0bf3400>, {})
connected = False
connecting = False
debug = False
encoding = 'latin-1'
ignore_log_types = frozenset({'warning'})
max_command_size_limit = <property object at 0x7f75e0bfc590>
use_encoding = 0
accept(self)
add_channel(self, map=None)
bind(self, addr)
close(self)
connect(self, address)
create_socket(self, family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>)
del_channel(self, map=None)
handle_accept(self)
handle_accepted(self, conn, addr)
handle_close(self)
handle_connect(self)
handle_connect_event(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')
process_message(self, peer, mailfrom, rcpttos, data, **kwargs)
readable(self)
recv(self, buffer_size)
send(self, data)
set_reuse_addr(self)
set_socket(self, sock, map=None)
writable(self)
accepting = False
addr = None
closing = False
connected = False
connecting = False
debug = False
ignore_log_types = frozenset({'warning'})
Devnull
flush(self)
write(self, msg)
MailmanProxy
writable.SMTPChannel
accept(self)
add_channel(self, map=None)
bind(self, addr)
close(self)
close_when_done(self)
automatically close this channel once the outgoing queue is empty
collect_incoming_data(self, data)
connect(self, address)
create_socket(self, family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>)
del_channel(self, map=None)
discard_buffers(self)
found_terminator(self)
get_terminator(self)
handle_accept(self)
handle_accepted(self, sock, addr)
handle_close(self)
handle_connect(self)
handle_connect_event(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)
initiate_send(self)
listen(self, num)
log(self, message)
log_info(self, message, type='info')
push(self, msg)
push_with_producer(self, producer)
readable(self)
predicate for inclusion in the readable for select()
recv(self, buffer_size)
send(self, data)
set_reuse_addr(self)
set_socket(self, sock, map=None)
set_terminator(self, term)
Set the input delimiter.
Can be a fixed string of any length, an integer, or None.
smtp_DATA(self, arg)
smtp_EHLO(self, arg)
smtp_EXPN(self, arg)
smtp_HELO(self, arg)
smtp_HELP(self, arg)
smtp_MAIL(self, arg)
smtp_NOOP(self, arg)
smtp_QUIT(self, arg)
smtp_RCPT(self, arg)
smtp_RSET(self, arg)
smtp_VRFY(self, arg)
writable(self)
predicate for inclusion in the writable for select()
COMMAND = 0
DATA = 1
ac_in_buffer_size = 65536
ac_out_buffer_size = 65536
accepting = False
addr = None
closing = False
command_size_limit = 512
command_size_limits = defaultdict(<function SMTPChannel.<lambda> at 0x7f75e0bf3400>, {})
connected = False
connecting = False
debug = False
encoding = 'latin-1'
ignore_log_types = frozenset({'warning'})
max_command_size_limit = <property object at 0x7f75e0bfc590>
use_encoding = 0
accept(self)
add_channel(self, map=None)
bind(self, addr)
close(self)
connect(self, address)
create_socket(self, family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>)
del_channel(self, map=None)
handle_accept(self)
handle_accepted(self, conn, addr)
handle_close(self)
handle_connect(self)
handle_connect_event(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')
process_message(self, peer, mailfrom, rcpttos, data)
readable(self)
recv(self, buffer_size)
send(self, data)
set_reuse_addr(self)
set_socket(self, sock, map=None)
writable(self)
accepting = False
addr = None
closing = False
connected = False
connecting = False
debug = False
ignore_log_types = frozenset({'warning'})
Options
classname = 'PureProxy'
enable_SMTPUTF8 = False
setuid = True
size_limit = None
PureProxy
writable.SMTPChannel
accept(self)
add_channel(self, map=None)
bind(self, addr)
close(self)
close_when_done(self)
automatically close this channel once the outgoing queue is empty
collect_incoming_data(self, data)
connect(self, address)
create_socket(self, family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>)
del_channel(self, map=None)
discard_buffers(self)
found_terminator(self)
get_terminator(self)
handle_accept(self)
handle_accepted(self, sock, addr)
handle_close(self)
handle_connect(self)
handle_connect_event(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)
initiate_send(self)
listen(self, num)
log(self, message)
log_info(self, message, type='info')
push(self, msg)
push_with_producer(self, producer)
readable(self)
predicate for inclusion in the readable for select()
recv(self, buffer_size)
send(self, data)
set_reuse_addr(self)
set_socket(self, sock, map=None)
set_terminator(self, term)
Set the input delimiter.
Can be a fixed string of any length, an integer, or None.
smtp_DATA(self, arg)
smtp_EHLO(self, arg)
smtp_EXPN(self, arg)
smtp_HELO(self, arg)
smtp_HELP(self, arg)
smtp_MAIL(self, arg)
smtp_NOOP(self, arg)
smtp_QUIT(self, arg)
smtp_RCPT(self, arg)
smtp_RSET(self, arg)
smtp_VRFY(self, arg)
writable(self)
predicate for inclusion in the writable for select()
COMMAND = 0
DATA = 1
ac_in_buffer_size = 65536
ac_out_buffer_size = 65536
accepting = False
addr = None
closing = False
command_size_limit = 512
command_size_limits = defaultdict(<function SMTPChannel.<lambda> at 0x7f75e0bf3400>, {})
connected = False
connecting = False
debug = False
encoding = 'latin-1'
ignore_log_types = frozenset({'warning'})
max_command_size_limit = <property object at 0x7f75e0bfc590>
use_encoding = 0
accept(self)
add_channel(self, map=None)
bind(self, addr)
close(self)
connect(self, address)
create_socket(self, family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>)
del_channel(self, map=None)
handle_accept(self)
handle_accepted(self, conn, addr)
handle_close(self)
handle_connect(self)
handle_connect_event(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')
process_message(self, peer, mailfrom, rcpttos, data)
readable(self)
recv(self, buffer_size)
send(self, data)
set_reuse_addr(self)
set_socket(self, sock, map=None)
writable(self)
accepting = False
addr = None
closing = False
connected = False
connecting = False
debug = False
ignore_log_types = frozenset({'warning'})
SMTPChannel
accept(self)
add_channel(self, map=None)
bind(self, addr)
close(self)
close_when_done(self)
automatically close this channel once the outgoing queue is empty
collect_incoming_data(self, data)
connect(self, address)
create_socket(self, family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>)
del_channel(self, map=None)
discard_buffers(self)
found_terminator(self)
get_terminator(self)
handle_accept(self)
handle_accepted(self, sock, addr)
handle_close(self)
handle_connect(self)
handle_connect_event(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)
initiate_send(self)
listen(self, num)
log(self, message)
log_info(self, message, type='info')
push(self, msg)
push_with_producer(self, producer)
readable(self)
predicate for inclusion in the readable for select()
recv(self, buffer_size)
send(self, data)
set_reuse_addr(self)
set_socket(self, sock, map=None)
set_terminator(self, term)
Set the input delimiter.
Can be a fixed string of any length, an integer, or None.
smtp_DATA(self, arg)
smtp_EHLO(self, arg)
smtp_EXPN(self, arg)
smtp_HELO(self, arg)
smtp_HELP(self, arg)
smtp_MAIL(self, arg)
smtp_NOOP(self, arg)
smtp_QUIT(self, arg)
smtp_RCPT(self, arg)
smtp_RSET(self, arg)
smtp_VRFY(self, arg)
writable(self)
predicate for inclusion in the writable for select()
COMMAND = 0
DATA = 1
ac_in_buffer_size = 65536
ac_out_buffer_size = 65536
accepting = False
addr = None
closing = False
command_size_limit = 512
command_size_limits = defaultdict(<function SMTPChannel.<lambda> at 0x7f75e0bf3400>, {})
connected = False
connecting = False
debug = False
encoding = 'latin-1'
ignore_log_types = frozenset({'warning'})
max_command_size_limit = <property object at 0x7f75e0bfc590>
use_encoding = 0
SMTPServer
writable.SMTPChannel
accept(self)
add_channel(self, map=None)
bind(self, addr)
close(self)
close_when_done(self)
automatically close this channel once the outgoing queue is empty
collect_incoming_data(self, data)
connect(self, address)
create_socket(self, family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>)
del_channel(self, map=None)
discard_buffers(self)
found_terminator(self)
get_terminator(self)
handle_accept(self)
handle_accepted(self, sock, addr)
handle_close(self)
handle_connect(self)
handle_connect_event(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)
initiate_send(self)
listen(self, num)
log(self, message)
log_info(self, message, type='info')
push(self, msg)
push_with_producer(self, producer)
readable(self)
predicate for inclusion in the readable for select()
recv(self, buffer_size)
send(self, data)
set_reuse_addr(self)
set_socket(self, sock, map=None)
set_terminator(self, term)
Set the input delimiter.
Can be a fixed string of any length, an integer, or None.
smtp_DATA(self, arg)
smtp_EHLO(self, arg)
smtp_EXPN(self, arg)
smtp_HELO(self, arg)
smtp_HELP(self, arg)
smtp_MAIL(self, arg)
smtp_NOOP(self, arg)
smtp_QUIT(self, arg)
smtp_RCPT(self, arg)
smtp_RSET(self, arg)
smtp_VRFY(self, arg)
writable(self)
predicate for inclusion in the writable for select()
COMMAND = 0
DATA = 1
ac_in_buffer_size = 65536
ac_out_buffer_size = 65536
accepting = False
addr = None
closing = False
command_size_limit = 512
command_size_limits = defaultdict(<function SMTPChannel.<lambda> at 0x7f75e0bf3400>, {})
connected = False
connecting = False
debug = False
encoding = 'latin-1'
ignore_log_types = frozenset({'warning'})
max_command_size_limit = <property object at 0x7f75e0bfc590>
use_encoding = 0
accept(self)
add_channel(self, map=None)
bind(self, addr)
close(self)
connect(self, address)
create_socket(self, family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>)
del_channel(self, map=None)
handle_accept(self)
handle_accepted(self, conn, addr)
handle_close(self)
handle_connect(self)
handle_connect_event(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')
process_message(self, peer, mailfrom, rcpttos, data, **kwargs)
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.
kwargs is a dictionary containing additional information. It is
empty if decode_data=True was given as init parameter, otherwise
it will contain the following keys:
'mail_options': list of parameters to the mail command. All
elements are uppercase strings. Example:
['BODY=8BITMIME', 'SMTPUTF8'].
'rcpt_options': same, for the rcpt command.
This function should return None for a normal `250 Ok' response;
otherwise, it should return the desired response string in RFC 821
format.
readable(self)
recv(self, buffer_size)
send(self, data)
set_reuse_addr(self)
set_socket(self, sock, map=None)
writable(self)
accepting = False
addr = None
closing = False
connected = False
connecting = False
debug = False
ignore_log_types = frozenset({'warning'})
Functions
get_addr_spec
get_addr_spec(value)
addr-spec = local-part "@" domain
get_angle_addr
get_angle_addr(value)
angle-addr = [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr
obs-angle-addr = [CFWS] "<" obs-route addr-spec ">" [CFWS]
parseargs
parseargs()
usage
usage(code, msg='')
warn
warn(message, category=None, stacklevel=1, source=None)
Issue a warning, or maybe ignore it or raise an exception.
Other members
COMMASPACE = ', '
DATA_SIZE_DEFAULT = 33554432
DEBUGSTREAM = <smtpd.Devnull object at 0x7f75e0bd9d20>
NEWLINE = '\n'
program = '/nix/store/3hj7jdn5dygvzz68wbrigldinh3xrd8s-amethyst-0.0.1/bin/amethyst'
Modules
asynchat
asyncore
collections
errno
getopt
os
socket
sys
time