Home >Backend Development >PHP Tutorial >IMap获取信件内容怎么筛选邮件??谁做过?请教了

IMap获取信件内容怎么筛选邮件??谁做过?请教了

WBOY
WBOYOriginal
2016-06-23 14:20:201221browse

<?phprequire_once('../ImapMailbox.php');// IMAP must be enabled in Google Mail Settingsdefine('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 "<pre class="brush:php;toolbar:false">";var_dump($mails);



关键是这里 foreach($mailbox->searchMails('ALL') as $mailId) {

这个参数ALL,可以换成其他的吗

不然邮箱里有10万封信,要找10万次,而我只要找前1个小时的


回复讨论(解决方案)

我已经知道了 结贴

哇靠,刚进来就结贴了,结贴需要个拿分的人  

strpos 这个

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn