-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完美連接並獲取電子郵件,那麼,我將如何獲取它以檢索這些電子郵件的附件?任何幫助,將不勝感激!謝謝通過IMAP從電子郵件中檢索附件?
我有,可惜的是這些方法提供這樣做的愚蠢長的路。無論如何,無論如何做到了。 – 2013-05-02 12:47:23