diff options
| author | Barry Warsaw | 2009-11-26 15:26:02 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2009-11-26 15:26:02 -0500 |
| commit | ea9c39d303fcd29023459baf44d5e12834aaf477 (patch) | |
| tree | 91cf081adc0f2c46bc0cbfb7a4b87ea0937a4355 /src/mailman/mta | |
| parent | a26ed5b02a76dd26a72eb8acad819be47dca3049 (diff) | |
| download | mailman-ea9c39d303fcd29023459baf44d5e12834aaf477.tar.gz mailman-ea9c39d303fcd29023459baf44d5e12834aaf477.tar.zst mailman-ea9c39d303fcd29023459baf44d5e12834aaf477.zip | |
* The start of a conversion of bin/withlist to bin/mailman withlist
* Add lots of debugging to the SMTP delivery chain
* Move the VERP calculation to the deliver module, since this is the central
place we do delivery. For example, when it was in to_outgoing, other routes
for injecting the message may not have been verp'd. to_outgoing is now
really simple.
Diffstat (limited to 'src/mailman/mta')
| -rw-r--r-- | src/mailman/mta/base.py | 1 | ||||
| -rw-r--r-- | src/mailman/mta/deliver.py | 36 | ||||
| -rw-r--r-- | src/mailman/mta/verp.py | 1 |
3 files changed, 38 insertions, 0 deletions
diff --git a/src/mailman/mta/base.py b/src/mailman/mta/base.py index ff56094ac..38ed0d836 100644 --- a/src/mailman/mta/base.py +++ b/src/mailman/mta/base.py @@ -159,6 +159,7 @@ class IndividualDelivery(BaseDelivery): refused = {} recipients = msgdata.get('recipients', set()) for recipient in recipients: + log.debug('IndividualDelivery to: %s', recipient) # Make a copy of the original messages and operator on it, since # we're going to munge it repeatedly for each recipient. message_copy = copy.deepcopy(msg) diff --git a/src/mailman/mta/deliver.py b/src/mailman/mta/deliver.py index 696770894..85bb09991 100644 --- a/src/mailman/mta/deliver.py +++ b/src/mailman/mta/deliver.py @@ -28,6 +28,8 @@ __all__ = [ import time import logging +from lazr.config import as_boolean + from mailman.config import config from mailman.interfaces.mailinglist import Personalization from mailman.interfaces.mta import SomeRecipientsFailed @@ -73,6 +75,9 @@ def deliver(mlist, msg, msgdata): if not recipients: # Could be None, could be an empty sequence. return + # Calculate whether we should VERP this message or not. The results of + # this set the 'verp' key in the message metadata. + _calculate_verp(mlist, msg, msgdata) # Which delivery agent should we use? Several situations can cause us to # use individual delivery. If not specified, use bulk delivery. See the # to-outgoing handler for when the 'verp' key is set in the metadata. @@ -82,6 +87,7 @@ def deliver(mlist, msg, msgdata): agent = Deliver() else: agent = BulkDelivery(int(config.mta.max_recipients)) + log.debug('Using agent: %s', agent) # Keep track of the original recipients and the original sender for # logging purposes. original_recipients = msgdata['recipients'] @@ -152,3 +158,33 @@ def deliver(mlist, msg, msgdata): # Return the results if temporary_failures or permanent_failures: raise SomeRecipientsFailed(temporary_failures, permanent_failures) + + + +def _calculate_verp(mlist, msg, msgdata): + """Calculate whether this message should be VERP'd or not. + + This function works by side-effect. If the message should be VERP'd, then + the 'verp' key in msgdata is set to True, otherwise it is set to False. + """ + if 'verp' in msgdata: + # Honor existing settings. + return + # If personalization is enabled for this list and we've configured Mailman + # to always VERP personalized deliveries, then yes we VERP it. Also, if + # personalization is /not/ enabled, but verp_delivery_interval is set (and + # we've hit this interval), then again, this message should be + # VERP'd. Otherwise, no. + interval = int(config.mta.verp_delivery_interval) + if mlist.personalize <> Personalization.none: + if as_boolean(config.mta.verp_personalized_deliveries): + msgdata['verp'] = True + elif interval == 0: + # Never VERP. + msgdata['verp'] = False + elif interval == 1: + # VERP every time. + msgdata['verp'] = True + else: + # VERP every 'interval' number of times. + msgdata['verp'] = (int(mlist.post_id) % interval == 0) diff --git a/src/mailman/mta/verp.py b/src/mailman/mta/verp.py index c53276bdc..269eca4dc 100644 --- a/src/mailman/mta/verp.py +++ b/src/mailman/mta/verp.py @@ -58,6 +58,7 @@ class VERPMixin: """ sender = super(VERPMixin, self)._get_sender(mlist, msg, msgdata) if msgdata.get('verp', False): + log.debug('VERPing %s', msg.get('message-id')) recipient = msgdata['recipient'] sender_mailbox, sender_domain = split_email(sender) # Encode the recipient's address for VERP. |
