-1
<?php
        $mailbox = "myServer";
        $user = "myUserName";
        $pass = "myPassWord";

        $connection = imap_open($mailbox, $user, $pass) or die ("Can't connect: " . imap_last_error());
        $list = imap_getmailboxes($connection, "myServer", "*");

        if(is_array($list)) {
            foreach($list as $key => $val) {
                echo "($key)";
                echo imap_utf7_decode($val->name) . ",";
                echo "'" . $val->delimiter . "',";
                echo $val->attributes . "<br />\n";
            }

        } else {
            echo "imap_getmailboxes failed: " . imap_last_error() . "\n";
        }            

        /* Search mailbox for unseen messages */
        $search = imap_search($connection, 'UNSEEN');

        $header = imap_headerinfo($connection, 1);
        $emailFrom =  $header->from[0]->mailbox . "@" . $header->from[0]->host;

        if($search) {
            echo $emailFrom;
        }


        /* Close the mailbox */
        imap_close($connection);
    ?>

这是我的代码......到目前为止,它通过 IMAP 完美连接并获取电子邮件,我将如何获取它来检索这些电子邮件的附件?任何帮助,将不胜感激!谢谢你

4

1 回答 1

0

stackoverflow 上已经有很多这样的问题了。你试过搜索吗?

于 2013-04-29T17:14:24.433 回答