aboutsummaryrefslogtreecommitdiffstats
path: root/python/download_emails.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/download_emails.py')
-rw-r--r--python/download_emails.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/python/download_emails.py b/python/download_emails.py
index 21d5794a..a9139ea3 100644
--- a/python/download_emails.py
+++ b/python/download_emails.py
@@ -158,19 +158,19 @@ def save_emails(update=True):
date = parsedate_to_datetime(message['date'])
if date.tzinfo is None:
date = date.replace(tzinfo=timezone('utc'))
+ date = date.astimezone(timezone('America/New_York'))
body = message.get_body('plain')
content = body.get_content()
except (KeyError, UnicodeDecodeError) as e:
logging.error("error decoding " + msg['id'])
continue
else:
- email = p / msg['id']
+ email = p / "{:%Y-%m-%d %H-%M-%S}_{}".format(date, msg['id'])
with email.open("w") as fh:
- fh.write("{:.0f}\r\n".format(date.timestamp()*1000))
fh.write(subject + "\r\n")
fh.write(content)
try:
- new_history_id = msg['id']
+ new_history_id = message.history_id
with open(os.path.join(os.environ['DATA_DIR'], '.lastHistoryId'), 'w') as fh:
fh.write(new_history_id)
except UnboundLocalError: