douzongmu2543 2018-12-06 09:26
浏览 45

流明:IMAP库搜索日期不起作用

I am using below library in my composer.json file

"php-imap/php-imap": "3.0.*",

My code is below,

$folder['shortpath']="Inbox";
    new \PhpImap\Mailbox('{'.$mdata["server"].":993/imap/ssl}". $folder['shortpath'], $mdata["user"], $mdata["pass"], $dir);
                        $mailsIds = $mailbox->searchMailbox($mailbox, 'SINCE "01 December 2018"');
                        echo"<pre>";print_r($mailsIds);die;

It gives me empty array instead of value of UIDs

I have total 4 emails after 1st december

If I am using below code,

$mailsIds = $mailbox->searchMailbox("ALL");
                            echo"<pre>";print_r($mailsIds);die;

then it gives me all emails till date in inbox

but date wise seach is not working


if I write below code then it gives error:

 $mailsIds = $mailbox->searchMailbox('SINCE 01 December 2018');

ERROR:

IMAP method imap_search() failed with error: Unknown search criterion: SINCE 2018-12-06 09:32:32←

I found my solution as below , it is working for me,

I have userd

mailsIds = $mailbox->searchMailbox('SINCE "01 December 2018"');

but while open connection pass one more argument for "US-ASCII"

new \PhpImap\Mailbox('{'.$mdata["server"].":993/imap/ssl}".
                    $folder['shortpath'], $mdata["user"], $mdata["pass"], $dir, "US-ASCII");

But my another question is it is gives me list of new messages based on given date,

I required all update emails also like new mail, mark as unread, flagged , unflagged etc from given date. How to achive this??

Means how to identify new emails and any activity on existing emails till given date

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
    • ¥15 matlab有关常微分方程的问题求解决
    • ¥15 perl MISA分析p3_in脚本出错
    • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
    • ¥15 ubuntu虚拟机打包apk错误
    • ¥199 rust编程架构设计的方案 有偿
    • ¥15 回答4f系统的像差计算
    • ¥15 java如何提取出pdf里的文字?
    • ¥100 求三轴之间相互配合画圆以及直线的算法