如何使用PHP从Gmail帐户访问SPAM文件夹?这是我连接到gmails imap服务器的代码。当我用垃圾邮件替换INBOX时会导致异常:
$mailbox = imap_open("{imap.googlemail.com:993/ssl}INBOX", "USERNAME@googlemail.com", "PASSWORD");
$mail = imap_search($mailbox, "ALL");
$mail_headers = imap_headerinfo($mailbox, $mail[0]);
$subject = $mail_headers->subject;
$from = $mail_headers->fromaddress;
imap_close($mailbox);