add debugging and handle no content disposition

This commit is contained in:
Morgan McMillian 2020-08-15 18:15:38 -07:00
parent 6babc1b53b
commit 41a9b6e73f

View file

@ -22,6 +22,9 @@ def parse(data, pnut, mstdn):
disposition = part.get_content_disposition() disposition = part.get_content_disposition()
contentType = part.get_content_type() contentType = part.get_content_type()
logger.debug(disposition)
logger.debug(contentType)
if contentType == "multipart/mixed": if contentType == "multipart/mixed":
continue continue
@ -40,7 +43,15 @@ def parse(data, pnut, mstdn):
else: else:
logger.debug("unknown disposition") logger.debug("unknown disposition")
logger.debug(disposition) logger.debug(disposition)
if contentType == "text/plain":
body = part.get_payload(decode=True).decode("utf-8")
else:
logger.error("can't get the message, bailing out")
return
logger.debug(data['Subject'])
logger.debug(body)
logger.debug(len(attachments))
if pnut: if pnut:
post_pnut(data['Subject'], body, attachments) post_pnut(data['Subject'], body, attachments)