Index: mailer.py =================================================================== --- mailer.py (revision 4212) +++ mailer.py (working copy) @@ -70,8 +70,7 @@ if multipart: message = MIMEMultipart() else: - message = Message() - message.set_type('text/plain') + message = MIMEText("") message.set_charset(charset) try: @@ -99,8 +98,6 @@ # finally, an aid to debugging problems message['X-Roundup-Version'] = __version__ - message['MIME-Version'] = '1.0' - return message def standard_message(self, to, subject, content, author=None): @@ -141,29 +138,25 @@ elif error_messages_to == "both": to.append(dispatcher_email) - message = self.get_standard_message(to, subject) + message = self.get_standard_message(to, subject, multipart=True) # add the error text - part = MIMEText(error) + part = MIMEText('\n'.join(error)) message.attach(part) # attach the original message to the returned message try: bounced_message.rewindbody() - except IOError, message: - body.write("*** couldn't include message body: %s ***" - % bounced_message) + except IOError, errmessage: + part = MIMEText("*** couldn't include message body: %s ***" + % errmessage) else: - body.write(bounced_message.fp.read()) - part = MIMEText(bounced_message.fp.read()) - part['Content-Disposition'] = 'attachment' - for header in bounced_message.headers: - part.write(header) + part = MIMEText(bounced_message.fp.read()) message.attach(part) # send try: - self.smtp_send(to, str(message)) + self.smtp_send(to, message.as_string()) except MessageSendError: # squash mail sending errors when bouncing mail # TODO this *could* be better, as we could notify admin of the