gpt4 book ai didi

php - Zend Mail 消息内容

转载 作者:行者123 更新时间:2023-12-04 18:38:26 24 4
gpt4 key购买 nike

我正在使用 Zend Mail 从我的 POP3 服务器获取电子邮件列表,并将其显示在网页上。这是我的代码:

<?

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>";
}

?>

问题是一些电子邮件显示如下:
    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

我该怎么做呢?谢谢你。

最佳答案

getContent方法获取整个消息体。您在那里看到的是整个主体,由两个 MIME 部分及其分隔符组成。

There's an example in the manual -- 搜索“多部分” -- 如何使用 the MIME parts直接地。

关于php - Zend Mail 消息内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5534765/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com