【问题标题】:I want to get html of a mail by imap protocol in php我想通过 php 中的 imap 协议获取邮件的 html
【发布时间】:2014-03-13 18:05:16
【问题描述】:

我想在 PHP 中使用 IMAP 协议获取电子邮件的 html 正文。

我使用了 IMAP 模块的 imap_fetchbody() 功能,但没有收到电子邮件的 html 正文。 有可能吗?

如果可能的话,使用哪个函数或代码?

【问题讨论】:

    标签: php gmail-imap


    【解决方案1】:

    如果您可以控制自己的服务器,请安装并使用 PEAR 包。 他们非常擅长打开和编辑 IMAP 和 mbox 等邮件格式

    【讨论】:

      【解决方案2】:

      如果你想在 html 中获取邮件正文,

      $html_message = imap_fetchbody($inbox,$email_number, "1.2"); 
               // NOTE: "1.2" here is a string and not an integer.
      

      详情:

      ()Root Message Part (multipart/related)
      (1) The text parts of the message (multipart/alternative)
      (1.1) Plain text version (text/plain)
      (1.2) HTML version (text/html)
      (2) The background stationary (image/gif)
      

      http://www.php.net/manual/en/function.imap-fetchbody.php

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-12-06
        • 2013-12-24
        • 2010-11-07
        • 1970-01-01
        • 2015-04-24
        相关资源
        最近更新 更多