summaryrefslogtreecommitdiff
path: root/Doc/library/smtpd.rst
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2012-05-26 14:33:59 -0400
committerR David Murray <rdmurray@bitdance.com>2012-05-26 14:33:59 -0400
commitd1a30c939cc6378423dd3cc22382a9abe2a7d882 (patch)
treed083d5bab633c09a9e9857987f8d2b960a00c396 /Doc/library/smtpd.rst
parent032eed3c4a42ca29de2c07fba2e0555eaff1700c (diff)
downloadcpython-git-d1a30c939cc6378423dd3cc22382a9abe2a7d882.tar.gz
#8739: upgrade smtpd to RFC 5321 and 1870.
smtpd now handles EHLO and has infrastructure for extended smtp command mode. The SIZE extension is also implemented. In order to support parameters on MAIL FROM, the RFC 5322 parser from the email package is used to parse the address "token". Logging subclasses things and overrides __init__, so it was necessary to update those __init__ functions in the logging tests to make the logging tests pass. The original suggestion and patch were by Alberto Trevino. Juhana Jauhiainen added the --size argument and SIZE parameter support. Michele OrrĂ¹ improved the patch and added more tests. Dan Boswell conditionalized various bits of code on whether or not we are in HELO or EHLO mode, as well as some other improvements and tests. I finalized the patch and added the address parsing.
Diffstat (limited to 'Doc/library/smtpd.rst')
-rw-r--r--Doc/library/smtpd.rst20
1 files changed, 17 insertions, 3 deletions
diff --git a/Doc/library/smtpd.rst b/Doc/library/smtpd.rst
index c391f710df..82f476344a 100644
--- a/Doc/library/smtpd.rst
+++ b/Doc/library/smtpd.rst
@@ -20,17 +20,24 @@ specific mail-sending strategies.
Additionally the SMTPChannel may be extended to implement very specific
interaction behaviour with SMTP clients.
+The code supports :RFC:`5321`, plus the :rfc:`1870` SIZE extension.
+
+
SMTPServer Objects
------------------
-.. class:: SMTPServer(localaddr, remoteaddr)
+.. class:: SMTPServer(localaddr, remoteaddr, data_size_limit=33554432)
Create a new :class:`SMTPServer` object, which binds to local address
*localaddr*. It will treat *remoteaddr* as an upstream SMTP relayer. It
inherits from :class:`asyncore.dispatcher`, and so will insert itself into
:mod:`asyncore`'s event loop on instantiation.
+ *data_size_limit* specifies the maximum number of bytes that will be
+ accepted in a ``DATA`` command. A value of ``None`` or ``0`` means no
+ limit.
+
.. method:: process_message(peer, mailfrom, rcpttos, data)
Raise :exc:`NotImplementedError` exception. Override this in subclasses to
@@ -155,11 +162,15 @@ SMTPChannel Objects
Command Action taken
======== ===================================================================
HELO Accepts the greeting from the client and stores it in
- :attr:`seen_greeting`.
+ :attr:`seen_greeting`. Sets server to base command mode.
+ EHLO Accepts the greeting from the client and stores it in
+ :attr:`seen_greeting`. Sets server to extended command mode.
NOOP Takes no action.
QUIT Closes the connection cleanly.
MAIL Accepts the "MAIL FROM:" syntax and stores the supplied address as
- :attr:`mailfrom`.
+ :attr:`mailfrom`. In extended command mode, accepts the
+ :rfc:`1870` SIZE attribute and responds appropriately based on the
+ value of ``data_size_limit``.
RCPT Accepts the "RCPT TO:" syntax and stores the supplied addresses in
the :attr:`rcpttos` list.
RSET Resets the :attr:`mailfrom`, :attr:`rcpttos`, and
@@ -167,4 +178,7 @@ SMTPChannel Objects
DATA Sets the internal state to :attr:`DATA` and stores remaining lines
from the client in :attr:`received_data` until the terminator
"\r\n.\r\n" is received.
+ HELP Returns minimal information on command syntax
+ VRFY Returns code 252 (the server doesn't know if the address is valid)
+ EXPN Reports that the command is not implemented.
======== ===================================================================