1
0
mirror of https://github.com/imapsync/imapsync.git synced 2024-11-17 00:02:29 +01:00
imapsync/FAQ.d/FAQ.Dates.txt

114 lines
4.5 KiB
Plaintext
Raw Normal View History

2016-09-19 17:15:41 +02:00
#!/bin/cat
2019-07-03 01:17:46 +02:00
$Id: FAQ.Dates.txt,v 1.9 2018/11/04 09:27:17 gilles Exp gilles $
2016-09-19 17:15:41 +02:00
2019-07-03 01:17:46 +02:00
This documentation is also available online at
https://imapsync.lamiral.info/FAQ.d/
https://imapsync.lamiral.info/FAQ.d/FAQ.Dates.txt
2016-09-19 17:15:41 +02:00
2019-07-03 01:17:46 +02:00
=======================================================================
Imapsync tips about dates.
=======================================================================
2016-09-19 17:15:41 +02:00
2018-05-07 16:04:23 +02:00
Questions answered in this FAQ are:
2017-09-23 23:54:48 +02:00
Q. We have found that the time and date displayed have been changed to
the time at which the file was synchronized. What happened? Any fix?
Q. Is there a way to set any message with
"Date: (Invalid)" to a valid one like
"Date: Thu, 1 Jun 2017 23:59:59 +0000"?
2016-09-19 17:15:41 +02:00
=======================================================================
Q. We have found that the time and date displayed have been changed to
2017-09-23 23:54:48 +02:00
the time at which the file was synchronized. What happened? Any fix?
2016-09-19 17:15:41 +02:00
R. This is the case by default with some email readers like:
- Outlook 2003
- Ipad
but not with:
- Mutt
- Thunderbird
- Zimbra
- Gmail
2019-07-03 01:17:46 +02:00
A first thing to keep in mind.
Imapsync does not touch any byte of messages unless told to
do so by special options like --regexmess or --pipemess.
Messages on both parts should be exactly identical because
imapsync does a verbatim sync of all messages.
2016-09-19 17:15:41 +02:00
Now I explain the whole picture about dates of messages.
2019-07-03 01:17:46 +02:00
There are several different dates attached to any message.
2016-09-19 17:17:24 +02:00
First, there is the "Date:" header, which belongs to the message itself.
2019-07-03 01:17:46 +02:00
You can see this "Date:" header line by asking "View->Message Source"
2016-09-19 17:17:24 +02:00
in most email client software (Ctrl-u in Thunderbird).
2019-07-03 01:17:46 +02:00
Most of the time, this "Date:" header date is set by the MUA,
MUA stands for "Mail User Agent".
2016-09-19 17:17:24 +02:00
MUA can be Outlook, Thunderbird, a webmail or Mutt etc.
2019-07-03 01:17:46 +02:00
The "Date:" header is usually the date the message was written
2016-09-19 17:15:41 +02:00
or sent the first time, at the writer side.
2016-09-19 17:17:24 +02:00
This "Date:" header line is never changed by any transfer or copy.
2016-09-19 17:15:41 +02:00
If an email reader uses the "Date:" header for displaying the date of a
message then no problem should arise.
Another date is the internal date. In IMAP, the internal date is handled
2019-07-03 01:17:46 +02:00
by the imap server and normally it corresponds to the arrival date in the mailbox.
2016-09-19 17:17:24 +02:00
This date is not part of the email message itself, it's a metadata kept
by the imap server.
2016-09-19 17:15:41 +02:00
The IMAP protocol allows the internal date to be set by a email client
when a message is delivered by the imap APPEND command.
2019-07-03 01:17:46 +02:00
Imapsync synchronizes these internal dates, by default, so internal dates
on host2 should then be the same as the internal dates on host1.
2016-09-19 17:15:41 +02:00
If an email reader uses the internal date for displaying the date of a
message then the sync date problem only occurs when the host2 server software
ignores the internal date given by imapsync during the APPEND imap
command. It happens with some imap servers.
There are also the "Received:" header lines. Each time a message travels
a SMTP server, this one adds a "Received:" header line. Sometimes
some email clients use the last "Received:" header date as the date of the
message. And some IMAP servers software add a "Received:" line after
and imap transfer. If those both conditions are met then the date
displayed become the transfer date even if imapsync
has done its best to keep all the dates synchronized. Bad luck.
Solutions:
2019-07-03 01:17:46 +02:00
a) Use another email client or configure it in order that it sorts messages
by sent dates, the "Date:" header line.
2016-09-19 17:15:41 +02:00
b) Use a imap server that respects the imap RFC and accepts
2019-07-03 01:17:46 +02:00
the internal date set by imapsync.
2016-09-19 17:15:41 +02:00
2017-09-23 23:54:48 +02:00
c) Try to understand why the email client software shows another date
2019-07-03 01:17:46 +02:00
than the "Date:" header line.
2016-09-19 17:15:41 +02:00
=======================================================================
2017-09-23 23:54:48 +02:00
Q. Is there a way to set any message with
"Date: (Invalid)" to a valid one like
"Date: Thu, 1 Jun 2017 23:59:59 +0000"?
R. Yes, there is a way with option --regexmess
First, let's select only messages with a buggy Date header:
--search "HEADER Date Invalid"
Second, let's change this line by a valid one,
2016-09-19 17:15:41 +02:00
2017-09-23 23:54:48 +02:00
on windows:
--regexmess "s{\A(.*?(?! ^$))^Date:\ \(Invalid\)(.*?)$}{$1Date: Thu, 1 Jun 2017 23:59:59 +0000}xms"
on Unix (replaced enclosing double-quotes " by single quotes ' ):
--regexmess 's{\A(.*?(?! ^$))^Date:\ \(Invalid\)(.*?)$}{$1Date: Thu, 1 Jun 2017 23:59:59 +0000}xms'
=======================================================================
=======================================================================