fix: Properly get and decode the body of the email

pull/232/head
Raphaël Vinot 2018-05-08 11:02:32 +02:00
parent cb15bdfca1
commit 04d3183115
1 changed files with 2 additions and 2 deletions

View File

@ -40,8 +40,8 @@ class EMailObject(AbstractMISPObjectGenerator):
return to_return
def generate_attributes(self):
if self.__email.get_body():
self.add_attribute('email-body', value=self.__email.get_body().as_string())
if self.__email.get_body(preferencelist=('html', 'plain')):
self.add_attribute('email-body', value=self.__email.get_body(preferencelist=('html', 'plain')).get_payload(decode=True).decode())
if 'Reply-To' in self.__email:
self.add_attribute('reply-to', value=self.__email['Reply-To'])
if 'Message-ID' in self.__email: