#!/usr/bin/php
<?php
$mbox = imap_open ("{imap.gmail.com:993/imap/ssl}INBOX","[email protected]", "XXXXXXXX") or die ('无法连接 IMAP 服务器');
// 获得新邮件列表
$struct = imap_fetchstructure($mbox,1);
$parts = $struct->parts;
$count=count($parts);
for($i=0;$i<=$count;$i++){
if($parts[$i]->disposition == "ATTACHMENT"){
//echo 'filename;'.$parts[$i]->dparameters[0]->value;
}
}
$body=imap_fetchbody($mbox,1,2);
$body=base64_decode($body);
$body=imap_utf8($body);
print_r($body);
?>
|