我使用Zend Mail來獲取我的POP3服務器中的電子郵件列表,並將其顯示在網頁上。這裏是我的代碼:Zend郵件內容
<?
require("Zend/Mail/Storage/Pop3.php");
$mail = new Zend_Mail_Storage_Pop3(array('host' => 'localhost',
'user' => 'person',
'password' => 'awesome'));
// show the mail!
echo "You have " . $mail->countMessages() . " messages! <br><br>";
foreach ($mail as $message) {
echo "From: '{$message->from}'<br> Subject: {$message->subject}<br>";
echo "Content: " . $message->getContent() . "<br><br>";
}
?>
的問題是,一些email都出現了這樣的:
From: 'Trey '
Subject: WOMBATS WOMBATS
Content: --Apple-Mail-1--609821059 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii SWIMMING IN THE OCEAN CAUSIN' A COMOTION CUZ THEY SUCK --Apple-Mail-1--609821059 Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=us-ascii SWIMMING IN THE OCEAN
CAUSIN' A COMOTION
CUZ THEY
SUCK
--Apple-Mail-1--609821059--
這使得它難以閱讀郵件的實際主體內容。我想讓它看起來像這樣:
From: 'Stan Flusterflap '
Subject: hi
Content: hi
我該如何去做這件事?謝謝。
你可能想要做一些有關整個袋熊蟲感染的事情。 – Charles 2011-04-04 05:15:07