簡體   English   中英

php imap無法讀取沒有附件的正文消息

[英]php imap not reading body message without attachment

我已經編寫了用於閱讀電子郵件的php代碼。 我在用

imap_fetchbody($this->conn, $i, 1.2);

用於顯示電子郵件。 當郵件帶有附件時,它的顯示方式會很好,但是如果電子郵件中沒有附件,則不會顯示任何內容。 當我使用

$body = imap_fetchbody($this->conn, $i, 1);

消息以文本/純格式顯示。 像這樣

this is system generated mail -- Regards! Md Belal 

當我使用

$body = imap_body($this->conn, $i);

它像這樣顯示

--047d7b5d2f88ddb36c050069a175 Content-Type: text/plain; charset=UTF-8 this is system generated mail -- Regards! Md Belal 8287326270 --047d7b5d2f88ddb36c050069a175 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 

this is system generated mail

-- 


Regards!
Md Belal
--047d7b5d2f88ddb36c050069a175--

我需要顯示得井井有條。 像這樣。

this is system generated mail

-- 


Regards!
Md Belal

該怎么辦請幫忙。 謝謝!

試試這個https://stackoverflow.com/a/14936048/2289510

順便說一句,我還沒有嘗試過,但是nl2br( http://hu1.php.net/nl2br )可能也可以為您提供幫助,當您的結果為text / plain格式並且包含\\ n \\ r個字符時,它會增加換行符。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM