Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Mail.app uses wrong Date Received time for an email

Hello,

I just moved my IMAP folders to a new server and realized there is a big issue with how Mail.app handles the DateReceived time for an email. This occurs on both MacOS and iPhoneOS...

Basically, rather than using the Date: header in the email it uses the time the file was written to the file system. This becomes a problem when files are copied to a new location on the server and the creation time of the file is changed.

Does anybody know of a fix to either change the way Mail.app behaves or to automatically edit the date stamp of the IMAP files on my server?

thanks a lot for your support
fabien

MacBookPro, Mac OS X (10.5.8), iPhone

Posted on Dec 19, 2009 5:04 PM

Reply
14 replies

Dec 19, 2009 6:54 PM in response to fabma

It sounds like a problem with the way you moved your files. The "Date:" header is when a message was sent. The only way to know when it was received is to look at when it actually arrived. If you move it on the server that date will change. You would see the receive date change no what what e-mail client you used.

Dec 20, 2009 12:46 AM in response to etresoft

OK, didn't realize the DateReceived info was actually taken from the server's file system and was not stored in the message's header...

On Mac, I can change Mail.app to display "DateSent" rather than "DateReceived". I could live with that? But I still have an issue on my iPhone...

Is there a trick on the iPhone or do you know of a script that will change the date of each IMAP message on my server's file system?

Dec 20, 2009 6:43 AM in response to fabma

fabma wrote:
On Mac, I can change Mail.app to display "DateSent" rather than "DateReceived". I could live with that? But I still have an issue on my iPhone...


View > Sort By > Date Sent (ou Présentation > Trier par > Date d'envoi en français)

Is there a trick on the iPhone or do you know of a script that will change the date of each IMAP message on my server's file system?


I don't know about the iPhone. On the IMAP server, there are receive dates in the message headers and it would be pretty easy for a skilled administrator to extract them and reset the message dates, I think. I have no idea if your mail administrators would be willing to do that or not.

Dec 21, 2009 1:21 PM in response to fabma

thanks a lot for all these answers, but they only confirms that Mail.app has a silly behavior and are not quite helping me solve my issue...

All email have both DateSent and DateReceived information in their headers. Rather than using this info, Mail.app uses the server's file system date. It looks like a bug to me!

When googling on this issue, I found many other users with the same problem (see http://mactip.blogspot.com/2008/04/fixing-mailapps-imap-date-problem.html)...

Dec 21, 2009 3:37 PM in response to fabma

fabma wrote:
All email have both DateSent and DateReceived information in their headers. Rather than using this info, Mail.app uses the server's file system date. It looks like a bug to me!


The sent date is a specific header field and you can have Apple Mail sort your messages on that field.

Receive date is not in any header field. It may be present in one or more separate fields, but it is not a specific value that can be easily extracted. Whomever screwed up your messages by moving them could write a script to try to extract these values and re-set the message dates. It isn't that hard, but it isn't something you want to do on a regular basis.

When googling on this issue, I found many other users with the same problem (see http://mactip.blogspot.com/2008/04/fixing-mailapps-imap-date-problem.html)...


To quote the author of that blog entry "Not mail.app's problem!"

The problem is on your server and that is where it needs to be fixed.

Jan 26, 2010 9:32 AM in response to etresoft

YES, it is Mail.App's problem. If you read the RFC for SMTP, the email server's mail exchanger has no other responsibility than to write the time breadcrumb information into the email header. If it is a smart mail server, it should write those time stamps UTC format rather than local time, but in the end it doesn't matter.

The final time stamp/breadcrumb in any message will be the time the server wrote the email down to the file system. The shortcomings in using the Server's time stamp of the file versus the mail program's timestamp in the envelope are so numerous it's not even possible to put them in one email, but for starters:

* The server being in one timezone and the customer email client being in another would result in invalid times

* Any backup or restore operations on the mail store could modify the access time on the file

* Any administrative functions (perhaps to expand the mail store space) wherein files need to be moved would update the file time stamp

* and on and on.

There is a reason the email envelope contains date/time stamps. This is a mail client (Mail.app) issue.

In the end, the MUA is responsible for doing the right thing and displaying it to the user. The Mail SERVER's responsiblity (in regards to time) ends when it writes the email to the file system. POP3/IMAP have nothing to do with it at all.

Mar 1, 2010 9:52 AM in response to fabma

Also having this problem. Glad to be onboard a thread that hasn't been 'archived'.

Anybody here using MobileMe? I cannot get the date order on the iPhone or me.com to work, despite the fact that Mail on the mac orders it by date automatically.

Is there a script that will reset the metadata according to the headers or something? I've no idea if such a script exists or would even be possible... if I find anything I'll post it here.

Mar 2, 2010 2:51 PM in response to paul clitheroe

My email account in "Mail" was working fine until the beginning of February, when suddenly the "Date Received" column in incoming emails and "Date Sent" column in outgoing emails changed the entire mailbox emails to the 14th of each month, even in my folders and archived emails. I need the actual dates for legal purposes. Help! Has anyone had this problem? and how can I fix it?

Apr 23, 2010 1:04 AM in response to bdowne01

I just changed hosting providers, and had to move approx 2 GB of mail from one IMAP server to another. So I created "archived inbox" and "archived sent" in "on my mac" and just dragged all the mail into there. No problem, all the dates showed up properly.

Then once the new IMAP server was set up I tried to drag the mail onto the server. The first problem was that I kept getting a lot of timeout errors so I had to drag approx 75 emails at a time. What a pain, but I don't know if that was the hosting provider's problem or Mail's problem. Anyway after a lot of mail dragging it was finally done, and then what do I find but all of the mail in the Inbox is shown with today's date! ***! I really need my mail to be organised and can't have it like that.

When I go into the hosting provider's webmail system, all the mail is shown with the correct date. Whew, there's a chance Mail didn't kill all the dates. After some searching I found this thread and changed Mail to show the Date Sent instead of Date Received. Okay, halfway there. I still think Mail is doing it wrong though. bdowne01's explanation is correct.

But now, on my iPhone, all the mail has the same date. Big problem. This is a simple problem with Apple's mail apps that should never have been in there.

May 7, 2010 1:14 AM in response to Botnik

Definately a mail.app problem...

My imap host got a webmail and there all mails are sortable when recieved, so I started look deeper into the issue.
Here is what happened I had some 2-3 GB of mails and subfolders on an IMAP and I moved host so I had to move the mails, this happened on 29th April.
I got all inbox material over with correct date (approx. 50% of the mails)
The subfolders were created and moved half of the folders show the right dates but the other half shows 29th april on all e-mails.

So, some mail are read "correct" others are read with the date they were created on the server...so for sure a mail.app problem.

I have tried "sync" and "rebuild" both seems to not change much at all.
I was thinking perhaps to delete the account and delete the local files then add the address again, but in "fear" of all are going to be dated wrong I've not tried this yet. I got time machine so I suppose I could do it.

Mail.app uses wrong Date Received time for an email

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.