Merge pull request #9 from markfeit/master

Format "From" line date with ctime(3) per RFC 4155.
This commit is contained in:
Rui Carmo 2018-12-28 18:59:33 +00:00 committed by GitHub
commit 83e030ad68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -124,6 +124,8 @@ def string_from_file(value):
return content.read().strip()
def download_messages(server, filename, messages, config):
"""Download messages from folder and append to mailbox"""
@ -157,9 +159,12 @@ def download_messages(server, filename, messages, config):
# each new message
for msg_id in messages.keys():
# This "From" and the terminating newline below delimit messages
# in mbox files
buf = "From nobody %s\n" % time.strftime('%a %b %d %H:%M:%S %Y')
# in mbox files. Note that RFC 4155 specifies that the date be
# in the same format as the output of ctime(3), which is required
# by ISO C to use English day and month abbreviations.
buf = "From nobody %s\n" % time.ctime()
# If this is one of our synthesised Message-IDs, insert it before
# the other headers
if UUID in msg_id: