Archived Forum Post

Index of archived forum posts

Question:

IMAP Search Since Result Mismatch!?

Dec 14 '15 at 07:47

Greetings, hope all are fine.. i am trying to go IMAP search on specific time frame.. for example i need to check the main that sent on month jul, so, i use following search criteria:

$objMSGSet = $objIMAP->Search('ALL SINCE "01-Jul-2015" Before "01-Aug-2015"', 1);

and checked the returned email date and noticed the time is as below:

here i gave some example:

m.xxxx@gmail.com = Tue, 30 Jun 2015 18:06:56 GMT
m12xxx6@gmail.com = Tue, 30 Jun 2015 18:16:30 GMT
sc1xxxx4@gmail.com = Wed, 01 Jul 2015 03:58:43 GMT
useoray3xxxxx72@gmail.com = Wed, 01 Jul 2015 03:59:44 GMT

please notice first two items date and time.. it shows jun month result :(

though it was told that IMAP since don't care about time and zone.. but i notice that my gmt is GMT+6.00 and if i add 6 hours it will be 1st JUL

any idea how to get only the message that is send on my since date range?

thanks in advance...

best regards


Answer

As per the IMAP Standard searches are based on the server date

SINCE <date>
         Messages whose internal date (disregarding time and timezone)
         is within or later than the specified date.

So I think the only way around this is the then check the date of the email within your application to remove emails the previous day.

You could also miss emails at the end of your search, eg late on 31st July so you may want to take that into account too.