strip email signature

This commit is contained in:
Morgan McMillian 2021-11-12 07:37:35 -08:00
parent c959e761cd
commit 839c9a52ef

View file

@ -18,6 +18,7 @@ logger = logging.getLogger()
def parse(data, pnut, mstdn):
body = ""
attachments = []
msg = []
for part in data.walk():
disposition = part.get_content_disposition()
@ -53,6 +54,14 @@ def parse(data, pnut, mstdn):
logger.debug(data['Subject'])
logger.debug(body)
logger.debug(len(attachments))
parsebody = body.split('\n')
for line in parsebody:
if line == "-- ":
break
msg.append(line)
body = '\n'.join(msg)
if pnut:
post_pnut(data['Subject'], body, attachments)