我想通过 php 中的 imap 协议获取邮件的 html



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

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

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

如果您可以控制自己的服务器,请安装并使用PEAR软件包。它们在打开和编辑邮件格式(如IMAP和mbox)方面非常出色

如果你想在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