我正在尝试使用imap_fetchbody
和PHP从gmail读取电子邮件正文,但是它不起作用,无法打印正文。
该邮件具有附件,其Mime类型为text/html
。
这是我的代码(使用其他类型的电子邮件也可以):
$string = quoted_printable_decode(imap_fetchbody($con,$email,2));
这是我的PHP代码:
$con is imap_open($server, $login, $password);
$email are email from imap_search all code is;
$connessione = imap_open($server, $login, $password);
$emails = imap_search($connessione, 'UNSEEN FROM "cc@cc.com"');
if (!empty($emails))
{
foreach ($emails as $email)
{
$string = quoted_printable_decode(imap_fetchbody($connessione,$email,2));
}
}
$ string是这样的: ---- boundary_13267_d232a838-e6ee-4fb8-bc76-85484f4b0772内容类型:text / html内容传输编码:base64 Cgo8aHRtbD4KPGhlYWQ + CjxNRVRBIGh ....
有人可以帮我吗?