dongshie8450 2016-09-24 11:29
浏览 448

使用imap_fetchbody函数无法获取完整的正文消息?

$emails = imap_search($inbox,'ALL');

foreach($emails as $email_number) {
        $message = imap_fetchbody($inbox,$email_number,2);
echo $message;

}

I am trying to get body of the gmail email message using imap_fetchbody function but I can't get the images and css I don't know what is going wrong?any help will be appreciated.

  • 写回答

1条回答 默认 最新

  • duanjue6575 2016-09-27 18:25
    关注

    Imap is quite involved, but without seeing the E-mail, my guess would be that the E-mail is either embedding the files or you are fetching the plain text rather than the HTML, so you will need to use imap_fetchstructure() to get all the parts and then reconstruct the E-mail.

    I wrote a very comprehensive wrapper for this a few months back, which you are welcome to take a look at on my GitHub:

    https://github.com/craigh411/ImapMailManager

    In particular, you might find my factory useful, which handles quite a bit of the type of work you are attempting:

    https://github.com/craigh411/ImapMailManager/blob/master/src/Factories/ImapMessageFactory.php

    E-mail is not trivial though, it took me weeks to write that package and while it's officially in beta, it is well tested, so you should be able to use it without too much trouble if you so wish.

    评论

报告相同问题?

悬赏问题

  • ¥15 python变量和列表之间的相互影响
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)