简体   繁体   English

使用日期通过php和imap电子邮件搜索gmail

[英]Email search gmail with php and imap using date

from gmail using PHP imap i need get all yesterday's emails. 从使用PHP imap的gmail中,我需要获取所有昨天的电子邮件。 My code: 我的代码:

$emails = imap_search($inbox, 'FROM "mytestemail@gmail.com" ON "2013-11-24"');

Everything seems simple and clear, but with a 24-day email i also get and several (1-3) emails from 25 days. 一切看起来都很简单明了,但是我还收到了一封24天的电子邮件,以及25天后收到的几封(1-3)电子邮件。 Same as if trying to look 22, 21 d. 就像尝试看22、21 d一样。 ... ...

Why gmail adds several letters from the next day? 为什么gmail从第二天起增加几个字母?

IMAP's date search isn't quite precise. IMAP的日期搜索不是很精确。 There are timezone issues. 存在时区问题。 The messages from the 25th are probably from the first hours after midnight, when it was still the 24th somewhere. 来自25号的消息可能是从午夜之后的第一个小时开始的,那时仍是24号。 You may also get messages from the 23rd, from locations where it was the 24th already. 您也可能会从23号的位置收到消息,而该位置已是24号。

Whether this is a bug or not depends on what you want the search to do. 这是否是错误,取决于您要搜索的内容。

I don't remember whether all IMAP servers behave in exactly the same way. 我不记得所有IMAP服务器的行为是否完全相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM