doucitao2944 2014-05-07 20:37
浏览 32

无法使用IMAP搜索

My email id have email with subject line "=?UTF-8?Q?=e2=99=a3?= Styles =?UTF-8?Q?=e2=99=a3?=" Now I want to use imap_search to search email with this subject line. But I am getting an error-:

Notice: Unknown: Unknown search criterion: STYLES (errflg=2) in Unknown on line 0

Below is search code I am using:

    $ToSearch=trim("=?UTF-8?Q?=e2=99=a3?= Styles to Freshen Up Your Home =?UTF-8?Q?=e2=99=a3?=");
        $unreadEmails= imap_search($loginToInbox,'SUBJECT  '.$ToSearch.' SINCE '.$dateToSearch.'');
var_dump($unreadEmails);

how can I search email with subject line.

  • 写回答

2条回答 默认 最新

  • duanjie6912 2014-05-07 22:46
    关注

    It seems pretty clear to me: it's tripping on the word "Styles". That's because there's a space so it thinks there should be a new IMAP keyword. Try enclosing it in quotes:

    $unreadEmails = imap_search($loginToInbox,'SUBJECT "'.$ToSearch.'" SINCE '.$dateToSearch);
    

    You'll also have to be careful with that $dateToSearch - you'll probably have to enclose it in quotes as well, and also make sure it's in the format that the server expects (most likely RFC2822 - see section 3.3, Date and Time Specification. See this other question for an example of what it should look like.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题