时间:2021-07-01 10:21:17 帮助过:6人阅读
require_once('../ImapMailbox.php');
// IMAP must be enabled in Google Mail Settings
define('GMAIL_EMAIL', '');
define('GMAIL_PASSWORD', '');
define('ATTACHMENTS_DIR', dirname(__FILE__) . '/attachments');
$mailbox = new ImapMailbox('{xxxx/notls}INBOX', GMAIL_EMAIL, GMAIL_PASSWORD, ATTACHMENTS_DIR, 'utf-8');
$mails = array();
foreach($mailbox->searchMails('ALL') as $mailId) {
$mail = $mailbox->getMail($mailId);
// $mailbox->setMailAsSeen($mail->mId);
// $mailbox->deleteMail($mail->mId);
$mails[] = $mail;
}
echo "";
var_dump($mails);
关键是这里 foreach($mailbox->searchMails('ALL') as $mailId) {
这个参数ALL,可以换成其他的吗
不然邮箱里有10万封信,要找10万次,而我只要找前1个小时的
------解决方案--------------------
哇靠,刚进来就结贴了,结贴需要个拿分的人