Skip to content

Commit

Permalink
Merge pull request #9 from jochen42/master
Browse files Browse the repository at this point in the history
[FIX] correct date on gmail (and other?) dest
  • Loading branch information
jarus committed Apr 2, 2016
2 parents 29921c8 + 3392ce6 commit 6fa01ee
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion imapcopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import imaplib
import logging
import argparse
import email


class IMAP_Copy(object):
Expand Down Expand Up @@ -127,9 +128,11 @@ def copy(self, source_mailbox, destination_mailbox, skip, limit):
status, data = self._conn_source.fetch(msg_num, '(RFC822 FLAGS)')
message = data[0][1]
flags = data[1][8:][:-2] # Not perfect.. Waiting for bug reports
msg = email.message_from_string(message);
msgDate = email.utils.parsedate(msg['Date'])

self._conn_destination.append(
destination_mailbox, flags, None, message
destination_mailbox, flags, msgDate, message
)

copy_count += 1
Expand Down

0 comments on commit 6fa01ee

Please sign in to comment.