我正在编写一个简单的 php 脚本来阅读电子邮件。
当我使用以下命令提取邮件正文时:
imap_body($mbox, $i);
我已经返回了这样的东西:
--0016e6db2b334d4d7904a883f4ec
Content-Type: text/plain; charset=ISO-8859-1
<The message arrived>
--0016e6db2b334d4d7904a883f4ec
Content-Type: text/html; charset=ISO-8859-1
<The message arrived>
--0016e6db2b334d4d7904a883f4ec--
我怎样才能只提取:?
我正在使用 php_imap。
Thanks.
如果您使用 IMAP,则可以使用 imap_body() 函数读取正文。
PHP 拥有大量可以帮助您解析电子邮件的函数。
http://www.php.net/manual/en/ref.imap.php http://www.php.net/manual/en/ref.imap.php
也查看 fetch_body() 函数。它将允许您仅获得身体的一部分。
http://www.php.net/manual/en/function.imap-fetchbody.php http://www.php.net/manual/en/function.imap-fetchbody.php
例如:
$message = imap_fetchbody($inbox,$email_number, 1.2);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)