def reply_body(self, use_empty=False):
        """Add quote characters and attribution to original body."""
        req_body = self.request.get('body', None)
        if req_body and not use_empty:
            return req_body

        # Remove message signature
        stripped_body = stripSignature(self.context.body)
        quoted_body = rewrapMessage(stripped_body, add_quote=True)

        attribution = _("reply-attribution", u"On ${date}, ${author} wrote:")
        attribution = Message(attribution, mapping={
            u'date': self.date(),
            u'author': self.mail_from_name(do_encode=False)})
        return translate(attribution) + '\r\n' + quoted_body + '\r\n'
Example #2
0
    def reply_body(self, use_empty=False):
        """Add quote characters and attribution to original body."""
        req_body = self.request.get('body', None)
        if req_body and not use_empty:
            return req_body

        # Remove message signature
        stripped_body = stripSignature(self.context.body)
        quoted_body = rewrapMessage(stripped_body, add_quote=True)

        attribution = _("reply-attribution", u"On ${date}, ${author} wrote:")
        attribution = Message(attribution,
                              mapping={
                                  u'date': self.date(),
                                  u'author':
                                  self.mail_from_name(do_encode=False)
                              })
        return translate(attribution) + '\r\n' + quoted_body + '\r\n'
 def createReply(self):
     """Generate a basic reply message, MailBoxer will take care of all the
        important headers, hopefully."""
     headers = {'Message-Id': self.new_message_id(),
                'In-Reply-To': self.orig_message_id(),
                'References': self.reply_references(),
                'Date': self.rfc_date(),}
     ml = self.getMailingList()
     encoding = getSiteEncoding(ml)
     body = rewrapMessage(decode(self.request.get('body'), ml))
     subject = decode(self.request.get('subject'), ml)
     message = construct_simple_encoded_message(from_addr=unicode(self.member_address(),encoding),
                                                to_addr=self.list_address(),
                                                subject=subject,
                                                body=body,
                                                other_headers=headers,
                                                encoding=encoding)
     return message.as_string()
Example #4
0
 def createReply(self):
     """Generate a basic reply message, MailBoxer will take care of all the
        important headers, hopefully."""
     headers = {
         'Message-Id': self.new_message_id(),
         'In-Reply-To': self.orig_message_id(),
         'References': self.reply_references(),
         'Date': self.rfc_date(),
     }
     ml = self.getMailingList()
     encoding = getSiteEncoding(ml)
     body = rewrapMessage(decode(self.request.get('body'), ml))
     subject = decode(self.request.get('subject'), ml)
     message = construct_simple_encoded_message(from_addr=unicode(
         self.member_address(), encoding),
                                                to_addr=self.list_address(),
                                                subject=subject,
                                                body=body,
                                                other_headers=headers,
                                                encoding=encoding)
     return message.as_string()