summaryrefslogtreecommitdiff
path: root/mailman/pipeline
diff options
context:
space:
mode:
Diffstat (limited to 'mailman/pipeline')
-rw-r--r--mailman/pipeline/docs/to-outgoing.txt19
-rw-r--r--mailman/pipeline/smtp_direct.py23
2 files changed, 24 insertions, 18 deletions
diff --git a/mailman/pipeline/docs/to-outgoing.txt b/mailman/pipeline/docs/to-outgoing.txt
index 046ed9be8..81e870e6c 100644
--- a/mailman/pipeline/docs/to-outgoing.txt
+++ b/mailman/pipeline/docs/to-outgoing.txt
@@ -65,8 +65,9 @@ option to VERP personalized deliveries is set, then the message will be
VERP'd.
# Save the original value for clean up.
- >>> verp_personalized_delivieries = config.VERP_PERSONALIZED_DELIVERIES
- >>> config.VERP_PERSONALIZED_DELIVERIES = True
+ >>> from mailman import Defaults
+ >>> verp_personalized_delivieries = Defaults.VERP_PERSONALIZED_DELIVERIES
+ >>> Defaults.VERP_PERSONALIZED_DELIVERIES = True
>>> from mailman.interfaces import Personalization
>>> mlist.personalize = Personalization.individual
>>> msgdata = dict(foo=1, bar=2)
@@ -79,7 +80,7 @@ VERP'd.
However, if the global configuration variable prohibits VERP'ing, even
personalized lists will not VERP.
- >>> config.VERP_PERSONALIZED_DELIVERIES = False
+ >>> Defaults.VERP_PERSONALIZED_DELIVERIES = False
>>> msgdata = dict(foo=1, bar=2)
>>> handler.process(mlist, msg, msgdata)
>>> print msgdata.get('verp')
@@ -93,8 +94,8 @@ Mailman how often to VERP even non-personalized mailing lists. It can be set
to zero, which means non-personalized messages will never be VERP'd.
# Save the original value for clean up.
- >>> verp_delivery_interval = config.VERP_DELIVERY_INTERVAL
- >>> config.VERP_DELIVERY_INTERVAL = 0
+ >>> verp_delivery_interval = Defaults.VERP_DELIVERY_INTERVAL
+ >>> Defaults.VERP_DELIVERY_INTERVAL = 0
>>> mlist.personalize = Personalization.none
>>> msgdata = dict(foo=1, bar=2)
>>> handler.process(mlist, msg, msgdata)
@@ -105,7 +106,7 @@ to zero, which means non-personalized messages will never be VERP'd.
If the interval is set to 1, then every message will be VERP'd.
- >>> config.VERP_DELIVERY_INTERVAL = 1
+ >>> Defaults.VERP_DELIVERY_INTERVAL = 1
>>> for i in range(10):
... msgdata = dict(foo=1, bar=2)
... handler.process(mlist, msg, msgdata)
@@ -126,7 +127,7 @@ If the interval is set to 1, then every message will be VERP'd.
If the interval is set to some other number, then one out of that many posts
will be VERP'd.
- >>> config.VERP_DELIVERY_INTERVAL = 3
+ >>> Defaults.VERP_DELIVERY_INTERVAL = 3
>>> for i in range(10):
... mlist.post_id = i
... msgdata = dict(foo=1, bar=2)
@@ -149,5 +150,5 @@ will be VERP'd.
Clean up
========
- >>> config.VERP_PERSONALIZED_DELIVERIES = verp_personalized_delivieries
- >>> config.VERP_DELIVERY_INTERVAL = verp_delivery_interval
+ >>> Defaults.VERP_PERSONALIZED_DELIVERIES = verp_personalized_delivieries
+ >>> Defaults.VERP_DELIVERY_INTERVAL = verp_delivery_interval
diff --git a/mailman/pipeline/smtp_direct.py b/mailman/pipeline/smtp_direct.py
index ab5ca0096..75c5da1ba 100644
--- a/mailman/pipeline/smtp_direct.py
+++ b/mailman/pipeline/smtp_direct.py
@@ -36,15 +36,16 @@ import copy
import time
import email
import socket
-import string
import logging
import smtplib
from email.Charset import Charset
from email.Header import Header
from email.Utils import formataddr
+from string import Template
from zope.interface import implements
+from mailman import Defaults
from mailman import Utils
from mailman.config import config
from mailman.core import errors
@@ -65,8 +66,11 @@ class Connection:
def __connect(self):
self.__conn = smtplib.SMTP()
- self.__conn.connect(config.SMTPHOST, config.SMTPPORT)
- self.__numsessions = config.SMTP_MAX_SESSIONS_PER_CONNECTION
+ host = config.mta.smtp_host
+ port = int(config.mta.smtp_port)
+ log.debug('Connecting to %s:%s', host, port)
+ self.__conn.connect(host, port)
+ self.__numsessions = Defaults.SMTP_MAX_SESSIONS_PER_CONNECTION
def sendmail(self, envsender, recips, msgtext):
if self.__conn is None:
@@ -122,10 +126,10 @@ def process(mlist, msg, msgdata):
chunks = [[recip] for recip in recips]
msgdata['personalize'] = 1
deliveryfunc = verpdeliver
- elif config.SMTP_MAX_RCPTS <= 0:
+ elif Defaults.SMTP_MAX_RCPTS <= 0:
chunks = [recips]
else:
- chunks = chunkify(recips, config.SMTP_MAX_RCPTS)
+ chunks = chunkify(recips, Defaults.SMTP_MAX_RCPTS)
# See if this is an unshunted message for which some were undelivered
if msgdata.has_key('undelivered'):
chunks = msgdata['undelivered']
@@ -316,7 +320,8 @@ def verpdeliver(mlist, msg, msgdata, envsender, failures, conn):
'mailbox': rmailbox,
'host' : DOT.join(rdomain),
}
- envsender = '%s@%s' % ((config.VERP_FORMAT % d), DOT.join(bdomain))
+ envsender = '%s@%s' % ((Defaults.VERP_FORMAT % d),
+ DOT.join(bdomain))
if mlist.personalize == Personalization.full:
# When fully personalizing, we want the To address to point to the
# recipient, not to the mailing list
@@ -378,10 +383,10 @@ def bulkdeliver(mlist, msg, msgdata, envsender, failures, conn):
# Send the message
refused = conn.sendmail(envsender, recips, msgtext)
except smtplib.SMTPRecipientsRefused, e:
- flog.error('%s recipients refused: %s', msgid, e)
+ log.error('%s recipients refused: %s', msgid, e)
refused = e.recipients
except smtplib.SMTPResponseException, e:
- flog.error('%s SMTP session failure: %s, %s',
+ log.error('%s SMTP session failure: %s, %s',
msgid, e.smtp_code, e.smtp_error)
# If this was a permanent failure, don't add the recipients to the
# refused, because we don't want them to be added to failures.
@@ -397,7 +402,7 @@ def bulkdeliver(mlist, msg, msgdata, envsender, failures, conn):
# MTA not responding, or other socket problems, or any other kind of
# SMTPException. In that case, nothing got delivered, so treat this
# as a temporary failure.
- flog.error('%s low level smtp error: %s', msgid, e)
+ log.error('%s low level smtp error: %s', msgid, e)
error = str(e)
for r in recips:
refused[r] = (-1, error)