PHP imap_body被截断

时间:2012-01-03 03:50:14

标签: php imap gmail-imap

我试图下载并同步imap电子邮件但是当我使用imap_body下载某些消息时,字符串被截断,它不会像我期望的那样检索整个原始消息,我错过了什么?这是我得到的代码:

$raw_headers = imap_fetchheader($imap, $msgno);
$message = $raw_headers;
$message .= imap_body($imap, $msgno);
echo $message;

一些邮件的最后一部分,其中附件被截断,像这样,这个特定的邮件实际上有2个附件,但它只显示一部分,有人可以帮我解决这个问题:

HEADERS GO HERE

This is a multi-part message in MIME format.

------_=_NextPart_001_01CB2F48.59B2C620
Content-Type: multipart/alternative; boundary="----_=_NextPart_002_01CB2F48.59B2C620"

------_=_NextPart_002_01CB2F48.59B2C620
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
PLAIN CONTENT GOES HERE
------_=_NextPart_002_01CB2F48.59B2C620
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
HTML CONTENT GOES HERE

------_=_NextPart_002_01CB2F48.59B2C620--

------_=_NextPart_001_01CB2F48.59B2C620
Content-Type: application/vnd.ms-excel; name="HPHS burnett,gJul14.xls"
Content-Transfer-Encoding: base64
Content-Description: HPHS burnett,gJul14.xls
Content-Disposition: attachment; filename="HPHS burnett,gJul14.xls"

0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAACAAAAkAAAAAAAAAAA
EAAAjAAAAAEAAAD+////AAAAAJIAAACRAAAA////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
//////////////////////////

1 个答案:

答案 0 :(得分:0)

我和imap_body有类似的问题,所以我尝试使用 imap_savebody 将正文保存到文件和回显文件内容,这对我来说很好。 希望它适合你。

参考:imap_savebody