Php imap_机构工作不正确?

Php imap_机构工作不正确?,php,email,imap,Php,Email,Imap,imap\u body不适合我,请告诉我我做错了什么 错误消息附带以下文本: “--0000000000007f934b0574cac3e4内容类型:文本/普通; charset=“UTF-8” Cxzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

imap\u body
不适合我,请告诉我我做错了什么

错误消息附带以下文本:

“--0000000000007f934b0574cac3e4内容类型:文本/普通; charset=“UTF-8” Cxzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz --000000000000 7F934B0574CAC3E4内容类型:text/html;charset=“UTF-8” Cxzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz --0000000000007f934b0574cac3e4--”

但它应该是唯一的

“cxzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

我的代码是:

function display_message($auth_user, $accountid, $messageid, $fullheaders) {
$buttons = array();
$buttons[0] = 'reply';
$buttons[1] = 'reply-all';
$buttons[2] = 'forward';
$buttons[3] = 'delete';
$buttons[4] = 'show-headers';

$message = retrieve_message($auth_user, $accountid, $messageid, $fullheaders);
if(count($message)==0) {
    echo "cannot retrieve message number $messageid".'.<br />';
} else {
    $imap =open_mailbox($auth_user, $accountid); ?>
    <table>
        <tr>
            <td>
                <b> Subject: </b>
            </td>
            <td>
                <b> <?php echo iconv_mime_decode($message['subject']);?> </b>
            </td>
        </tr>
        <tr>
            <td>
                <b> From: </b>
            </td>
            <td>
                <b> <?php echo iconv_mime_decode($message['fromaddress']);?> </b>
            </td>
        </tr>
        <tr>
            <td>
                <b> To: </b>
            </td>
            <td>
                <b> <?php echo iconv_mime_decode($message['toaddress']);?> </b>
            </td>
        </tr>
            <td>
                <b> Received: </b>
            </td>
            <td>
                <b> <?php echo iconv("cp1251", "UTF-8", strftime($message['date'])); ?> </b>

            </td>
        </tr>
    </table>
    <?php display_toolbar($buttons, "&messageid=$messageid"); ?>
    <table>
        <tr>
            <td>
                <?php echo iconv_mime_decode($message['fullheaders']); ?>
            </td>
        </tr>
    </table>
    <table>
        <tr>
            <td>
                <?php echo $message['body']; ?>
            </td>
        </tr>
    </table>
    <?php
}

这看起来是正确的,因为电子邮件的内容类型有两个不同的版本(
text/html
/
text/plain
)。两者也可以不同,根据上下文有不同的文本。好吧,我如何才能在消息中只获取“cxzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz($imap,$messageid,1);“函数中的retrieve_message,但我无法使用俄语输入消息。”0JXQn9Ci0JANCg==”
function retrieve_message($auth_user, $accountid, $messageid, $fullheaders) {
$message = array();
if(!($auth_user && $messageid && $accountid)) {
    var_dump(1);
    return false;
}

$imap = open_mailbox($auth_user, $accountid);
if(!$imap) {
    return false;
}

$header = imap_header($imap, $messageid);

if(!$header) {
    return false;
}

$message['body'] = imap_body($imap, $messageid));

if(!$message['body']) {
    $message['body'] = "[This message has no body]\n\n\n\n\n\n";
}

if($fullheaders) {
    $message['fullheaders'] = imap_fetchheader($imap, $messageid);
} else {
    $message['fullheaders'] = '';
}

$message['subject'] = $header->subject;
$message['fromaddress'] =   $header->fromaddress;
$message['toaddress'] =   $header->toaddress;
$message['date'] =   $header->date;

// note we can get more detailed information by using from and to
// rather than fromaddress and toaddress, but these are easier

imap_close($imap);
return $message;
}