diff options
| author | bwarsaw | 2002-04-10 04:38:12 +0000 |
|---|---|---|
| committer | bwarsaw | 2002-04-10 04:38:12 +0000 |
| commit | 7a822f26f9dd953644dc0d8ee5fa0058ed88d422 (patch) | |
| tree | 9dafb276e76095d1dd3b6321b5cc297230bedc6f | |
| parent | 256b627da62e1de10292e15f3b45facd56a460a4 (diff) | |
| download | mailman-7a822f26f9dd953644dc0d8ee5fa0058ed88d422.tar.gz mailman-7a822f26f9dd953644dc0d8ee5fa0058ed88d422.tar.zst mailman-7a822f26f9dd953644dc0d8ee5fa0058ed88d422.zip | |
An adaptation of Marc MERLIN's fixes to actually honor
SMTP_MAX_SESSIONS_PER_CONNECTION. Specifically,
sendmail(): We can't return directly from the try-clause because then
the decrement of __numsessions won't be executed. Instead, stash the
results in a local variable, twiddle numsessions, and then return the
results.
process(): When doing bulkdeliver, be sure to only decorate the
message once. This prevents multiple headers and footers if the
message is requeued because of some temporary delivery problem.
Note: we don't need to do this for verpdeliver because each message is
crafted uniquely anyway.
Also, get rid of an unused local variable.
| -rw-r--r-- | Mailman/Handlers/SMTPDirect.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Mailman/Handlers/SMTPDirect.py b/Mailman/Handlers/SMTPDirect.py index bf436cfe5..ff4a72a71 100644 --- a/Mailman/Handlers/SMTPDirect.py +++ b/Mailman/Handlers/SMTPDirect.py @@ -55,7 +55,7 @@ class Connection: def sendmail(self, envsender, recips, msgtext): try: - return self.__conn.sendmail(envsender, recips, msgtext) + results = self.__conn.sendmail(envsender, recips, msgtext) except smtplib.SMTPException: # For safety, reconnect self.__conn.quit() @@ -70,6 +70,7 @@ class Connection: if self.__numsessions == 0: self.__conn.quit() self.__connect() + return results def quit(self): self.__conn.quit() @@ -107,11 +108,13 @@ def process(mlist, msg, msgdata): chunks = msgdata['undelivered'] # If we're doing bulk delivery, then we can stitch up the message now. if deliveryfunc is None: - Decorate.process(mlist, msg, msgdata) + # Be sure never to decorate the message more than once! + if not msgdata.get('decorated'): + Decorate.process(mlist, msg, msgdata) + msgdata['decorated'] = 1 deliveryfunc = bulkdeliver refused = {} t0 = time.time() - numsessions = mm_cfg.SMTP_MAX_SESSIONS_PER_CONNECTION # Open the initial connection origrecips = msgdata['recips'] # `undelivered' is a copy of chunks that we pop from to do deliveries. |
