summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mailman/runners/lmtp.py27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/mailman/runners/lmtp.py b/src/mailman/runners/lmtp.py
index 249ab94c1..61db6b848 100644
--- a/src/mailman/runners/lmtp.py
+++ b/src/mailman/runners/lmtp.py
@@ -15,6 +15,9 @@
# You should have received a copy of the GNU General Public License along with
# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
+# XXX This module needs to be refactored to avoid direct access to the
+# config.db global.
+
"""Mailman LMTP runner (server).
Most mail servers can be configured to deliver local messages via 'LMTP'[1].
@@ -31,6 +34,14 @@ so that the peer mail server can provide better diagnostics.
http://www.faqs.org/rfcs/rfc2033.html
"""
+from __future__ import absolute_import, print_function, unicode_literals
+
+__metaclass__ = type
+__all__ = [
+ 'LMTPRunner',
+ ]
+
+
import email
import smtpd
import logging
@@ -80,15 +91,15 @@ SUBADDRESS_QUEUES = dict(
)
DASH = '-'
-CRLF = '\r\n'
-ERR_451 = '451 Requested action aborted: error in processing'
-ERR_501 = '501 Message has defects'
-ERR_502 = '502 Error: command HELO not implemented'
-ERR_550 = '550 Requested action not taken: mailbox unavailable'
-ERR_550_MID = '550 No Message-ID header provided'
+CRLF = b'\r\n'
+ERR_451 = b'451 Requested action aborted: error in processing'
+ERR_501 = b'501 Message has defects'
+ERR_502 = b'502 Error: command HELO not implemented'
+ERR_550 = b'550 Requested action not taken: mailbox unavailable'
+ERR_550_MID = b'550 No Message-ID header provided'
# XXX Blech
-smtpd.__version__ = 'Python LMTP runner 1.0'
+smtpd.__version__ = b'Python LMTP runner 1.0'
@@ -228,7 +239,7 @@ class LMTPRunner(Runner, smtpd.SMTPServer):
config.switchboards[queue].enqueue(msg, msgdata)
slog.debug('%s subaddress: %s, queue: %s',
message_id, canonical_subaddress, queue)
- status.append('250 Ok')
+ status.append(b'250 Ok')
except Exception:
slog.exception('Queue detection: %s', msg['message-id'])
config.db.abort()