This commit is contained in:
Julius Gonsior 2018-02-25 18:40:44 +00:00 committed by GitHub
commit e7615e4ecb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 3 deletions

View File

@ -1054,6 +1054,28 @@ remoteuser = username
#reference = Mail
# This option stands in the [Repository RemoteExapmle] section.
#
# Some mail provider like https://www.fastmail.com/ display in their web interface
# the internaldate of their emails. Therefore it is sometimes desirable, to set the
# internaldate to the value of the Date header.
#
# Available options are:
# - timestamp (the timestamp of the local file)
# - header (the Date header of the email)
# - imap (let the IMAP server set the internaldate)
#
# If nothing is set, or the given option is failing for some reasons, the following
# fallback strategy is being used:
# 1.) timestamp
# 2.) header
# 3.) imap
#
#internal_date_for_append_method = header
# DEPRECATED: This option stands in the [Repository RemoteExample] section.
#
# IMAP defines an encoding for non-ASCII ("international") characters. Enable

View File

@ -27,7 +27,6 @@ from offlineimap import imaputil, imaplibutil, emailutil, OfflineImapError
from offlineimap import globals
from offlineimap.virtual_imaplib2 import MonthNames
# Globals
CRLF = '\r\n'
MSGCOPY_NAMESPACE = 'MSGCOPY_'
@ -534,11 +533,17 @@ class IMAPFolder(BaseFolder):
:returns: string in the form of "DD-Mmm-YYYY HH:MM:SS +HHMM"
(including double quotes) or `None` in case of failure
(which is fine as value for append)."""
# if config parameter is set respect this setting:
# for the default value we don't need to change anything
internal_date_for_append_method = self.repository.getconf('internal_date_for_append_method', 'timestamp')
if rtime is None:
if rtime is None or internal_date_for_append_method == 'header':
rtime = emailutil.get_message_date(content)
if rtime == None:
if internal_date_for_append_method == 'imap' or rtime is None:
return None
datetuple = time.localtime(rtime)
try: