summaryrefslogtreecommitdiff
path: root/Mailman/Bouncer.py
diff options
context:
space:
mode:
authorbwarsaw1998-07-06 15:42:20 +0000
committerbwarsaw1998-07-06 15:42:20 +0000
commit3868d6b41a3faeb649e12e77a53829c2ad87729b (patch)
tree4b896b51d85875d19354962644cedbfcc55453bd /Mailman/Bouncer.py
parentc242ad1cd9b7d549353492158eee54214358a7bb (diff)
downloadmailman-3868d6b41a3faeb649e12e77a53829c2ad87729b.tar.gz
mailman-3868d6b41a3faeb649e12e77a53829c2ad87729b.tar.zst
mailman-3868d6b41a3faeb649e12e77a53829c2ad87729b.zip
Diffstat (limited to 'Mailman/Bouncer.py')
-rw-r--r--Mailman/Bouncer.py94
1 files changed, 46 insertions, 48 deletions
diff --git a/Mailman/Bouncer.py b/Mailman/Bouncer.py
index 7df85a31a..40fed2296 100644
--- a/Mailman/Bouncer.py
+++ b/Mailman/Bouncer.py
@@ -170,58 +170,56 @@ class Bouncer:
return
import mimetools
boundary = mimetools.choose_boundary()
- text = [""]
- text.append("(This MIME message should be"
- " readable as plain text.)")
- text.append("")
- text.append("--" + boundary)
- text.append("Content-type: text/plain; charset=us-ascii")
- text.append("")
- text.append("This is a mailman mailing list bounce action notice:")
- text.append("")
- text.append("\tMaillist:\t%s" % self.real_name)
- text.append("\tMember:\t\t%s" % addr)
- text.append("\tAction:\t\tSubscription %s%s." % (negative, did))
- text.append("\tReason:\t\tExcessive or fatal bounces.")
- if succeeded != 1:
- text.append("\tBUT:\t\t%s\n" % succeeded)
- text.append("")
- if did == "disabled" and succeeded == 1:
- text.append("You can reenable their subscription by visiting "
- "their options page")
- text.append("(via %s) and using your"
- % self.GetAbsoluteScriptURL('listinfo'))
- text.append(
- "list admin password to authorize the option change.")
- text.append("")
- text.append("The triggering bounce notice is attached below.")
- text.append("")
- text.append("Questions? Contact the mailman site admin,")
- text.append("\t" + mm_cfg.MAILMAN_OWNER)
+ # report about success
+ but = ''
+ if succeeded <> 1:
+ but = 'BUT: %s' % succeeded
+ # disabled?
+ if did == 'disabled' and succeeded == 1:
+ reenable = Utils.maketext(
+ 'reenable.txt',
+ {'listinfo_url': self.GetAbsoluteScriptURL('listinfo'),
+ })
+ else:
+ reenable = ''
+ # the mail message text
+ text = Utils.maketext(
+ 'bounce.txt',
+ {'boundary' : boundary,
+ 'listname' : self.real_name,
+ 'addr' : addr,
+ 'negative' : negative,
+ 'did' : did,
+ 'but' : but,
+ 'reenable' : reenable,
+ 'owneraddr': mm_cfg.MAILMAN_OWNER,
+ })
+ # add this here so it doesn't get wrapped/filled
+ text = text + '\n\n--' + boundary + \
+ '\nContent-type: text/plain; charset=us-ascii\n'
- text.append("")
- text.append("--" + boundary)
- text.append("Content-type: text/plain; charset=us-ascii")
- text.append("")
- text.append(string.join(msg.headers, ''))
- text.append("")
- text.append(Utils.QuotePeriods(msg.body))
- text.append("")
- text.append("--" + boundary + "--")
+ # we do this here so this text won't be wrapped. note that
+ # 'bounce.txt' has a trailing newline
+ text = text + \
+ string.join(msg.headers, '') + '\n' + \
+ Utils.QuotePeriods(msg.body) + '\n' + \
+ '--' + boundary + '--'
if negative:
negative = string.upper(negative)
- self.SendTextToUser(subject = ("%s member %s %s%s due to bounces"
- % (self.real_name, addr,
- negative, did)),
- recipient = recipient,
- sender = mm_cfg.MAILMAN_OWNER,
- add_headers = [
- "Errors-To: %s" % mm_cfg.MAILMAN_OWNER,
- "MIME-version: 1.0",
- "Content-type: multipart/mixed;"
- ' boundary="%s"' % boundary],
- text = string.join(text, '\n'))
+
+ self.SendTextToUser(
+ subject = "%s member %s %s%s due to bounces"
+ % (self.real_name, addr, negative, did),
+ recipient = recipient,
+ sender = mm_cfg.MAILMAN_OWNER,
+ add_headers = [
+ "Errors-To: %s" % mm_cfg.MAILMAN_OWNER,
+ "MIME-version: 1.0",
+ "Content-type: multipart/mixed;"
+ ' boundary="%s"' % boundary],
+ text = text)
+
def DisableBouncingAddress(self, addr):
"""Disable delivery for bouncing user address.