2010-04-05 50 views

回答

2

我會使用內置的PHP IMAP功能。以下是您的樣品:

$mbox = imap_open ("{yourserver.com:110/pop3/novalidate-cert}INBOX", "[email protected]", "myPassword"); 
if (!$mbox) { 
    return false; 
} 
$m_search = imap_search($mbox, 'UNDELETED'); 
     $messages = array(); 
     if($m_search < 1) { 
      return 'No New Messages'; 
     } else { 
      foreach ($m_search as $item) { 
       $headers = imap_headerinfo($mbox, $item); 
       $struct = imap_fetchstructure($mbox, $item); 
       $body = imap_body($mbox, $item); 

       $headers->subtype = $struct->subtype; 
       $headers->body = $body; 

       $messages[] = $headers; 

      } 
     } 

     imap_close($mbox); 
相關問題