2013-01-16 66 views
4

如何使用PHP從Gmail帳戶訪問垃圾郵件文件夾?這裏是我連接到gmails imap服務器的代碼。當我與SPAM取代INBOX它導致異常:從PHP訪問Gmail垃圾郵件文件夾

$mailbox = imap_open("{imap.googlemail.com:993/ssl}INBOX", "[email protected]", "PASSWORD"); 
$mail = imap_search($mailbox, "ALL"); 
$mail_headers = imap_headerinfo($mailbox, $mail[0]); 
$subject = $mail_headers->subject; 
$from = $mail_headers->fromaddress; 
imap_close($mailbox); 
+1

怎麼做你連接到Gmail?顯示您的代碼... –

+1

參見http://stackoverflow.com/questions/2185391/localized-gmail-imap-folders – tripleee

回答

3

從它看起來像文件夾名稱將是[Google Mail]/Spam[Gmail]/Spam

+3

或[Gmail] /垃圾郵件 – Max