mirror of https://github.com/MISP/mail_to_misp
fix: Do not fail if the email has no body.
parent
311e86ab36
commit
fe0bdb8f23
|
@ -95,7 +95,11 @@ class Mail2MISP():
|
||||||
|
|
||||||
def email_from_spamtrap(self):
|
def email_from_spamtrap(self):
|
||||||
'''The email comes from a spamtrap and should be attached as-is.'''
|
'''The email comes from a spamtrap and should be attached as-is.'''
|
||||||
self.clean_email_body = html.unescape(self.original_mail.get_body(preferencelist=('html', 'plain')).get_payload(decode=True).decode())
|
raw_body = self.original_mail.get_body(preferencelist=('html', 'plain'))
|
||||||
|
if raw_body:
|
||||||
|
self.clean_email_body = html.unescape(raw_body.get_payload(decode=True).decode())
|
||||||
|
else:
|
||||||
|
self.clean_email_body = ''
|
||||||
return self.forwarded_email(self.pseudofile)
|
return self.forwarded_email(self.pseudofile)
|
||||||
|
|
||||||
def forwarded_email(self, pseudofile: BytesIO):
|
def forwarded_email(self, pseudofile: BytesIO):
|
||||||
|
|
Loading…
Reference in New Issue