php imap 如何使用imap_sort 获取最近7 天的未读邮件?

php imap how to get unread mails of the last 7 days using imap_sort?

是否可以获取最近7天的未读消息。 ?我有

 $result = imap_sort($imap, SORTDATE, 1,"UNSEEN");

试试这个,

$msg = imap_search( $imap, "SINCE Mon, 12 Jan 2015 0:00:00 UNSEEN")

并检查下方 link 也

Need Help on IMAP INBOX Search based on received date

我找到了答案:

$date = date ( "d M Y", strToTime ( "-7 days" ) );
$search_criteria = "SINCE \"$date\""." UNSEEN";