Skip to content

Commit

Permalink
case insensitive header check
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyephron committed Jun 5, 2021
1 parent 0123f31 commit ce8dc03
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setuptools.setup(
name="simplegmail",
version="4.0.2",
version="4.0.3",
url="https://github.com/jeremyephron/simplegmail",
author="Jeremy Ephron",
author_email="[email protected]",
Expand Down
8 changes: 4 additions & 4 deletions simplegmail/gmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,16 +693,16 @@ def _build_message_from_ref(
subject = ''
msg_hdrs = {}
for hdr in headers:
if hdr['name'] == 'Date':
if hdr['name'].lower() == 'date':
try:
date = str(parser.parse(hdr['value']).astimezone())
except Exception:
date = hdr['value']
elif hdr['name'] == 'From':
elif hdr['name'].lower() == 'from':
sender = hdr['value']
elif hdr['name'] == 'To':
elif hdr['name'].lower() == 'to':
recipient = hdr['value']
elif hdr['name'] == 'Subject':
elif hdr['name'].lower() == 'subject':
subject = hdr['value']

msg_hdrs[hdr['name']] = hdr['value']
Expand Down

0 comments on commit ce8dc03

Please sign in to comment.