duandi8613 2015-07-10 11:24 采纳率: 100%
浏览 43

php imap,只有发件人的电子邮件才能获得结果

I am wanting to return emails of a specified senders email address only using IMAP and PHP, however the only example ive found that i can get working returns all emails, due to the amount of emails stored the code below takes a long time and often times out.

i have zero experience with this, and have read the php.net manual along with other resources so come to a dead end.

$mbox = imap_open("{outlook.office365.com:993/ssl}INBOX", "email-xxx", "pass-xxx")
     or die("can't connect: " . imap_last_error());

$MC = imap_check($mbox);

// Fetch an overview for all messages in INBOX
$result = imap_fetch_overview($mbox,"1:{$MC->Nmsgs}",0);

var_dump($result);
  • 写回答

1条回答 默认 最新

  • dounayan3643 2015-07-10 11:47
    关注

    You can use imap_search().

    array imap_search ( resource $imap_stream , string $criteria [, int $options = SE_FREE [, string $charset = NIL ]] )
    

    To get only mails from foo@bar.baz:

    $result = imap_search($mbox, 'FROM foo@bar.baz');
    
    评论

报告相同问题?

悬赏问题

  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥15 帮我写一个c++工程