Skip to content

Commit

Permalink
handle pdf attachment only mail
Browse files Browse the repository at this point in the history
There are some mails, which only consist of attachment without a body.
This takes care of application/pdf attachments.
  • Loading branch information
Anton Engelhardt committed Jun 24, 2022
1 parent 0040b41 commit e3dfa93
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions imbox/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,12 @@ def parse_email(raw_email, policy=None):
payload = decode_content(email_message)
body['plain'].append(payload)

elif maintype == 'application':
if email_message.get_content_subtype() == 'pdf':
attachment = parse_attachment(email_message)
if attachment:
attachments.append(attachment)

parsed_email['attachments'] = attachments

parsed_email['body'] = body
Expand Down

0 comments on commit e3dfa93

Please sign in to comment.