[email] Only abort MDA script if no MIME part is usable

This commit is contained in:
maike 2020-07-09 03:16:53 +02:00 committed by dl6tom
parent ae979c37f9
commit c2bdbc6f88

View file

@ -33,12 +33,11 @@ def main():
text = part.get_body(('plain',)) text = part.get_body(('plain',))
if not text: if not text:
text = re.sub(r'<[^>]*>', '', part.get_body(('html',))) text = re.sub(r'<[^>]*>', '', part.get_body(('html',)))
if not text:
logger.error('No suitable message body')
exit(0)
except Exception: except Exception:
logger.info("No Body in this message part", exc_info=True) logger.info("No Body in this message part", exc_info=True)
exit(0) if not text:
logger.error('No suitable message body')
exit(0)
# extract hood name from the envelope recipient address # extract hood name from the envelope recipient address
hood_name = args.recipient_address.split('@')[0] hood_name = args.recipient_address.split('@')[0]
hood = await Hood.objects.get(name=hood_name) hood = await Hood.objects.get(name=hood_name)