From 84ffced74912ffcdc882e0da66c3b2b879df02f4 Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Thu, 28 Feb 2002 23:36:28 +0000 Subject: __sendAdminBounceNotice(): Because the UserNotification constructor already sets the Content-Type: and MIME-Version: headers, don't do it explicitly (it'll add multiple headers). Instead just call set_type() to set the type to multipart/mixed. (Must do that before attempting to attach.) sendNextNotification(): Because we do not want the Subject: to be encoded, don't pass the subject into the UserNotification constructor. See MailList.ChangeMemberAddress() for details. --- Mailman/Bouncer.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Mailman/Bouncer.py b/Mailman/Bouncer.py index f65d33c6c..1802d53af 100644 --- a/Mailman/Bouncer.py +++ b/Mailman/Bouncer.py @@ -167,13 +167,14 @@ class Bouncer: umsg = Message.UserNotification(self.GetOwnerEmail(), siteowner, subject, lang=self.preferred_language) + # BAW: Be sure you set the type before trying to attach, or you'll get + # a MultipartConversionError. + umsg.set_type('multipart/mixed') umsg.attach(MIMEText(text)) if isinstance(msg, StringType): umsg.attach(MIMEText(msg)) else: umsg.attach(MIMEMessage(msg)) - umsg['Content-Type'] = 'multipart/mixed' - umsg['MIME-Version'] = '1.0' umsg.send(self) def sendNextNotification(self, member): @@ -194,7 +195,6 @@ class Bouncer: confirmurl = '%s/%s' % (self.GetScriptURL('confirm', absolute=1), info.cookie) optionsurl = self.GetOptionsURL(member, absolute=1) - subject = 'confirm ' + info.cookie reqaddr = self.GetRequestEmail() lang = self.getMemberLanguage(member) text = Utils.maketext( @@ -206,7 +206,11 @@ class Bouncer: 'password' : self.getMemberPassword(member), 'owneraddr' : self.GetOwnerEmail(), }, lang=lang, mlist=self) - msg = Message.UserNotification(member, reqaddr, subject, text, lang) + msg = Message.UserNotification(member, reqaddr, text=text, lang=lang) + # BAW: See the comment in MailList.py ChangeMemberAddress() for why we + # set the Subject this way. + del msg['subject'] + msg['Subject'] = 'confirm ' + info.cookie msg.send(self) info.noticesleft -= 1 info.lastnotice = time.localtime()[:3] -- cgit v1.2.3-70-g09d2