Skip to content

Commit

Permalink
case insensitive header check
Browse files Browse the repository at this point in the history
jeremyephron committed Mar 11, 2023
1 parent 35d6c79 commit 0ffc648
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
@@ -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="jeremyephron@gmail.com",
8 changes: 4 additions & 4 deletions simplegmail/gmail.py
Original file line number Diff line number Diff line change
@@ -728,16 +728,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']

0 comments on commit 0ffc648

Please sign in to comment.